When I am setting folder and directory permissions, who exactly is the user, the group and the others? For example, when I turn-off write permissions for βothersβ - which users does it affect?
When I am setting folder and directory permissions, who exactly is the user, the group and the others? For example, when I turn-off write permissions for βothersβ - which users does it affect?
Answers
Add AnswerOk - this is *nix administration 101. The logged in user (run whoami) is the USER. Then, the group that user belongs to is the GROUP. There may be other users in that group too. Everyone else is OTHER.
You have rwx on each entity - Read/Write/Execute permission.
So, file permissions are (User)(Group)(Other) when written in long-list form (ls -l).
So, when you do a long listing, you will see something like:
-rwxr--r-- (meta info like date, size, etc.) filename.
Read this wiki article on chmod to get a better idea:
http://en.wikipedia.org/wiki/Chmod
HTH.
Unix has users and groups. A user can belong to more than one group.
See /etc/passwd, /etc/group and the man pages on login and group.
That said, files in unix have permissions assigned for 3 entities:
owners, groups and others
Remember also that in unix, everything is a file...
Now, for each of the entities (owners/groups/others) you can set various permissions on files (files/directories/pipes/devices)...
Users in unix are assigned to groups. The owner of a file/folder/etc. is, at least at first, the active logged-in user who created it. The group assigned to the file at that time is the group represented in /etc/passwd for that user.
So, any other user's login that does not belong to the same group as the file creator's group is considered to be ""others"".
You can assign a user to more than one group to allow creation of cross-departmental supervisory roles. See /etc/group and the man pages on login and group.
You can give read, write and execute permissions to the owner, groups and others separately.
So lets say you have a folder named ""Folder"" and a file named ""File"".
You want to: 1) allow anyone who has access to the system to be able to look at the file 2) allow any logged in user that is assigned to the group ""group"" to change the file 3) allow only the owner of the file to be able to delete the file.
drwxr-xr-x 2 user group 4096 May 28 13:05 Folder
-rw-rw-r-- 1 user group 1024 May 28 13:05 Folder/File
The reason this works is that:
The folder pernmissions allow all users to browse the content inside the folder, because they can read and cd into it. The ""rwx"" for the owner allows the owner to create and/or delete files within the folder. No-one else can create or delete files. This is because they cannot ""write"" the directory file itself, which is a list of files in that particular folder.
The file is set to read access only for others, and read/write for anyone assigned to the group ""group"" and the owner. So this, in combination with the folder permissions, achieves the objective.
There are many more options, sticky bit/ setuid bit/ setgid bit etc.
When you have shared devices, handled by backgorund daemons, that require special permissions to create lock files, but need to be able to be accessed by everyone, then you have a real task to play with... - But, it can all be done with users, groups, permissions and functions to allow bits of things to be run as though they were a different user or group..."
Share your knowledge