While assigning permissions to a file with the command:
$ chmod +rwx file1.txt
Why is it that read and execute permissions are assigned to everybody, but write permission is only assigned to the user?
While assigning permissions to a file with the command:
$ chmod +rwx file1.txt
Why is it that read and execute permissions are assigned to everybody, but write permission is only assigned to the user?
chmod(1)
A combination of the lettersugoa
controls which users' access to the file will be changed: the user who owns it (u
), other users in the file's group (g
), other users not in the file's group (o
), or all users (a
). If none of these are given, the effect is as if (a
) were given, but bits that are set in theumask
are not affected.
This is pretty clear. You have to check your umask value:
$ umask
0002
$ touch xyz
$ ls -l xyz
-rw-rw-r-- 1 user user 0 Sep 6 22:56 xyz
$ chmod +rwx xyz
$ ls -l xyz
-rwxrwxr-x 1 user user 0 Sep 6 22:56 xyz
$ chmod a+rwx xyz
$ ls -l xyz
-rwxrwxrwx 1 user user 0 Sep 6 22:56 xyz
Have a look at this page: Default File Permissions: umask
yes it depends on the umask of your system u might be having 0022 as your umask
the resulting permission 777-022=755