group directory?
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?
|
You need to provide ownership to both the users through:
Code:
Code:
Code:
[user2@receiver group1-files]$ pwd |
But in that case, user2 won't be able to write/edit that file, correct?
and wouldn't the following just set the owner/group to user2.group1? Code:
[root@receiver ~]# chown -R user1.group1 /projects/group1-files/ |
He can !!
Just try out and see..He can edit without any issue? The Ownership is for both the users to edit/write/read the file |
Then I must be doing something wrong....
Code:
root@desktop# ls -ld /projects/files-groups1/ |
Hi,
This: Quote:
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.
|
Hi,
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? |
@your_shadow03: Overriding (forcing a write on a readonly file) only works in special cases (and linux and unix do differ on this one!).
- A normal user can only force a write (or delete) on someone elses's file if that file resides in a dir owned by that specific user: Code:
$ id Using chmod 2775 on a directory gives every user the possibility to edit/delete files in that directory. BTW: being root is a special case and has more privileges then other users. If you start testing with permissions do so with none-root users. Hope this clears things up a bit. |
My understanding...
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.
Am I correct? |
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> |
Druuna,
I have still few doubts and I need help. Code:
[root@receiver ~]# chown -R user1.group1 /projects/group1-files/ What I explored is : I have two users user1 and user2 and I added the both users to group1. As root, I created a directory : User - ROOT Code:
[root@receiver ~]# mkdir /Delta User - user1 Code:
[user1@receiver ~]$ groups |
Sorry I forgot to provide:
Code:
chmod 777 /Delta/projects User - Jerry Code:
[jerry@receiver projects]$ cd /Delta/projects/ |
@your_shadow03:
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 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). Another thing: Quote:
A chmod -R group1 /Delta will change the group to group1, but will leave the user in tact. |
All times are GMT -5. The time now is 06:57 PM. |