Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
OK I am a noob and I am trying to learn these file permissions here. I understand that the first number is YOUR permissions, the second is GROUP and the third is USERS permissions.
So here is my question, how do you define different permissions for different groups if there is only one group permission number.
For instance, lets say I have 3 groups (just to make it simple) ftptrusted, ftpusers, users.
Now I have a dir named ftphome. I want to allow ftptrusted to have full rights to the directory (rwx) and ftpusers to have read only (r). How would I go about this? If I do chmod 777 it gives everybody full rights. If I do 7 (mine permissions), 7 group permissions, 4 read only for users. How do I determine WHICH group is getting the 7 permissions.
OK, you need to remember some binary numbers here. The full permission string consists of three groups of permissions. Like you mentioned, it's permissions for
the owner: rwx (read write execute)
the group: rwx (read write execute)
the others: rwx (read write execute)
Each triple rwx is encoded by a binary number, where 0 means that the corresponding permission is unset, and 1 means that it's set. For example,
000 corresponds to ---
001 corresponds to --x
100 corresponds to r--
101 corresponds to r-x
111 corresponds to rwx
and so on. But each triple of bits is also a number, between 0 (000) and 7 (111)
in binary notation. For example, 6 is 110 which is rw- in permission string, 5 is 101, that is r-x and so on.
And each permission triple can be encoded by a single decimal number between 0 (no permissions) to 7 (full permissions).
For example, chmod 754 will give the file:
full permissions rwx for owner, (because 7 is 111 in binary)
read and execute permissions r-x for the group (because 5 is 101 in binary)
and read permissions only r-- for the "others" (because 4 is 100 in binary).
HTH.
You're setting permissions for the group that owns the file (or the directory). Each file belongs to a user and to a group.
Run ls -l in the directory where your file or the directory resides. For example, in my /home directory
I have two subdirectories, teddy and ftp. "teddy" belongs to the user named teddy and to the group called root. ftp belongs to the user root and the group "root". The second triple in the permission strings for the subdirectories say what the members of that group can do to the directories.
You can change the group ownership of the file by running the chgrp command.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.