LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-28-2009, 11:53 AM   #1
epamuk
Member
 
Registered: May 2007
Posts: 62

Rep: Reputation: 15
How can i give permissions to a folder?


Hi,

I want to give full permission to only two user. This two user must be have write, delete, read permission But Only this two user must be have this permissions.

How can i give this permissions? How to must i do settings with which commands? How to must be group and user settings of this folder?

Thanks.
 
Old 12-28-2009, 11:54 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
for two users, you'd want to put them in an additional group together and make the directory be owned by that group, with appropriate permissions.
 
Old 12-28-2009, 11:58 AM   #3
epamuk
Member
 
Registered: May 2007
Posts: 62

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by acid_kewpie View Post
for two users, you'd want to put them in an additional group together and make the directory be owned by that group, with appropriate permissions.
Thank you for quickly answer. But I want to know, How can i do this two user of same group memeber?

And How to must i do owned permissions of this folder as this group?
 
Old 12-28-2009, 12:11 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
Unless you're using ACL extensions on ext3 or something then the only way to do this is to create a new group, add those two users to the group and change the ownership of the directory to the new group you created.

groupadd somegroup
usermod dave -a -G somegroup
usermod fred -a -G somegroup
chgrp somegroup /that/folder/where/ever/it/is
chmod g+rwx /that/folder/where/ever/it/is
 
Old 12-28-2009, 12:51 PM   #5
epamuk
Member
 
Registered: May 2007
Posts: 62

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by acid_kewpie View Post
Unless you're using ACL extensions on ext3 or something then the only way to do this is to create a new group, add those two users to the group and change the ownership of the directory to the new group you created.

groupadd somegroup
usermod dave -a -G somegroup
usermod fred -a -G somegroup
chgrp somegroup /that/folder/where/ever/it/is
chmod g+rwx /that/folder/where/ever/it/is
Hi Cris,

I am getting this error messages when I run the this commands. Why i am getting this "usermod: user somegroup does not exist" message?

Quote:
[root@34istlinuxtest ~]# groupadd somegroup
[root@34istlinuxtest ~]# adduser dave
[root@34istlinuxtest ~]# usermod dave -a -G somegroup
usermod: user somegroup does not exist
[root@34istlinuxtest ~]# adduser fred
[root@34istlinuxtest ~]# usermod fred -a -G somegroup
usermod: user somegroup does not exist
 
Old 12-28-2009, 02:15 PM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
I wrote the command in the wrong order apparently. Read the usermod manpage for correct syntax.
 
Old 12-30-2009, 01:37 PM   #7
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by acid_kewpie View Post
Unless you're using ACL extensions on ext3 or something then the only way to do this is to create a new group, add those two users to the group and change the ownership of the directory to the new group you created.

groupadd somegroup
usermod dave -a -G somegroup
usermod fred -a -G somegroup
chgrp somegroup /that/folder/where/ever/it/is
chmod g+rwx /that/folder/where/ever/it/is
I don't think it's enough.
While definitely only dave and fred will be able read/write files in this folder they likely will not be able change files created by another user
(unless files created with permissions 0666.

I suggest
Code:
chmod 2070 /that/folder/where/ever/it/is
After that all files created under this directory will have group 'somegroup'
If users' umask is 002 (standard on RedHat-like system) then SGID bit on directory + umask will provide all memeber of 'somegroup' with read/write access to all files under /that/folder/where/ever/it/is directory
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can i give permission for see a folder contents? epamuk Linux - General 1 09-23-2009 10:03 AM
Want to write to folder, but, don't want to give 777 rights suruchiparimu Linux - Security 2 02-08-2006 10:11 AM
permissions difference between /home/..../folder and /root/folder darkleaf Linux - General 3 07-21-2005 05:23 PM
Not able to give execute permissions needanyhelp? Linux - General 4 08-20-2004 05:19 AM
How do I give mounting permissions? TheMusicGuy Linux - Security 4 04-20-2004 09:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration