chmod command The "chmod" command is to change the file's mode bit. chmod will change the file mode (permissions) of each given file, folder, script, etc. according to the required mode. There are 3 types of permissions in the file (folder or other, for simplicity, we use the file) ?
123 |
Read (r)=4 Write(w)=2 Execute(x)=1 |
So if you want to give the file read-only permission, set to ' 4 '; write-only permission, set the permission to ' 2 '; Execute permission only, set to 1; Read and Write permissions, that is 4+2 = 6, and so on. Now you need to set up 3 user and user group permissions. The first one is the owner, then the user's group, and finally the other user. ?
The root privilege here is rwx ( Read and write and Execute permissions ), The owning User group permission is r-x ( only Read and Execute permissions, no write permission), For other user rights-x(only Execute permissions) In order to change its permissions, the owner, the user group and other users to provide read, write, execute permissions. ?
1 |
[email protected]:~ # chmod 777 abc.sh |
Three are only read and write access ?
1 |
[email protected]:~ # chmod 666 abc.sh |
The owner user has read-write and Execute permissions, and the user's group and other users have only executable permissions ?
1 |
[email protected]:~ # chmod 711 abc.sh |
Note: This command is one of the most useful commands for system administrators and users. In a multiuser environment or server, for a user, if the file is set is not accessible, then this command can be resolved, if the wrong permissions are set, then provides for authorized access. |