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.
I created a group called group1, and put users user1 and user2 into group1. I want these two users to be able to work together on files in the same directory-- so I created a directory called /projects/group1-files, chmod'd it to 2775. Now, when either user can create files/subdirectories in the directory, but when they create a new file, it's permission is 755, so user1 can't write to files created by user2 and vice versa. I could set the umask to 002, but that wouldn't be limited to the directory. What is the correct way to do this?
[user1@receiver group1-files]$ touch test
[user1@receiver group1-files]$ ls
test
[user1@receiver group1-files]$ vi test
[user1@receiver group1-files]$ cat test
Hello can yu see me
[user1@receiver group1-files]$
user2
Code:
[user2@receiver group1-files]$ pwd
/projects/group1-files
[user2@receiver group1-files]$ cat test
Hello can yu see me
[user2@receiver group1-files]$
Last edited by your_shadow03; 05-13-2009 at 02:29 AM.
Does what abolishtheun expects: it will first make user1 owner (first command) of all the files/dirs and then make user2 owner. It will definitely _not_ make both users owner of these files!! (On a group level it does, but a chgrp -R group1 would have done the same).
Setting 2775 on the dir will give other user the possibility to save files, even though they don't have write permissions, but you do need to force the save (for example :w vs :w! in vi).
druuna, thanks for the clarification, I thought I was going crazy... does it matter that the group directories (the /projects dir) are on a separate partition? I know that you can set umasks for some file systems but not for ext3! I just want to avoid umask 002 in /etc/profile if possible.
It doesn't matter what FS as long as the FS is linux/unix (ext2/3/4, reiser etc). If the partition is none-linux (vfat, ntfs etc) other considerations will surface and complicate things.
As long as you (and your colleagues?) don't mind forcing the write, you do not need to change the umask setting.
@Druuna..
I can see most often say, if I try editing /etc/sudoers if logged-in as root, it says "READONLY" and I need to Press ESC and then press I. Edit the file but save it as wq!.
! is used to override which is same case as above.
Why so?
What I can understand is if we give "chmod 2775" permissions to a directory (owning by group), it means that (7 - user, 7 - group, 5 - other) that the group (here: user1, user2) can have both read/write permissions.
You missed the initial "2" -
The initial '2' sets the setguid bit for group ownership, so any new files created in that directory will now be owned by group <groupname>
Last edited by your_shadow03; 05-13-2009 at 06:19 AM.
Now The Doubt is Say, a user called jerry who is outside this group
User - Jerry
Code:
[jerry@receiver projects]$ cd /Delta/projects/
[jerry@receiver projects]$ cat test
hello I am user1 just edited this line
I am user2 ...Sounds working for setguid
Hi I am jerry outside this group
[jerry@receiver projects]$
How can she edit this since she is outside the group.
Last edited by your_shadow03; 05-13-2009 at 06:41 AM.
You did change the permissions of Delta (the chmod 2777 /Delta command), you did _not_ change permissions of the projects directory....
An ordinary user is, in this case, able to create a file in /Delta, but not in projects:
Code:
$ id
uid=500(druuna) gid=500(internet)
$ cd /Delta/
$ touch in.delta
$ ls -l in.delta
-rw-r----- 1 druuna root 0 May 13 13:32 in.delta
$ cd projects/
$ touch in.projects
touch: cannot touch `in.projects': Permission denied
Also: If you create the dir as root, the group will also be root (take a look at the output of the ls -l in.delta command).
Creating the dir as user root is sometimes needed, but do change the owner/group (group in this specific case) of that dir to reflect the appropriate group (group1 in this example).
As I stated before, this isn't useful. The second command will change the changes made in the first command (talking about the owner of the files/dirs).
A chmod -R group1 /Delta will change the group to group1, but will leave the user in tact.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.