The difference between 755 and 4755
chmod is a command to set file permissions under Linux. The following numbers indicate the permissions of different users or user groups.
Usually three numbers:
The first number indicates the permissions of the file owner
The second number represents the permissions of other users who belong to the same user group as the file owner
The third number indicates the permissions of other user groups.
There are three types of permissions: read (r=4), write (w=2), and execute (x=1). In summary, there are readable and executable (rx=5=4+1), readable and writable (rw=6=4+2), and readable, writable and executable (rwx=7=4+2+1).
So, chmod 755 sets the user’s permissions to:
1. The file owner can read, write and execute
2. Other users who belong to the same user group as the file owner can read and execute
3. Readable and executable by other user groups
The difference between chmod 4755 and chmod 755 is that there is one more digit at the beginning. This 4 means that when other users execute the file, they have the same permissions as the owner.
For example: the root user has created an Internet authentication program netlogin. If other users also need to use this program to access the Internet, the root user needs to run the chmod 755 netlogin command so that other users can also run netlogin.
However, when executing netlogin, you may need to access some files that only the root user has access to. Then other users may not be able to access the Internet due to insufficient permissions when executing netlogin.
In this case, you can use chmod 4755 netlogin to set other users to have root user permissions when executing netlogin, so as to access the Internet smoothly.