LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-07-2010, 04:06 AM   #1
ytd
Member
 
Registered: Jan 2009
Posts: 205

Rep: Reputation: 31
chmod 777 a directory only for a user not for all


I want to let user x to have all rights (delete, create, append, etc) on a directory / folder. But I want only that user to have R+W rights to that directory, and therefor I can't do chmod 777 to that directory, 'cause there are other users that needs to have only read access to that directory / folder. I'm using vsftp server and I'm letting the users to connect with the totalcomander client.
 
Old 05-07-2010, 04:18 AM   #2
ytd
Member
 
Registered: Jan 2009
Posts: 205

Original Poster
Rep: Reputation: 31
Like... I'll create:

user1
user2
user3

I want user1 to be able to read, delete and write in that folder / directory.
I want user2 to have only read access and write access to the same folder / directory.
I want user3 to have only read access to the same folder / directory.

How do I do this ?

I want to do this NOT with samba, I want to do this with the ftp (vsftp).
 
Old 05-07-2010, 04:20 AM   #3
Absent Minded
Member
 
Registered: Nov 2007
Location: Washington State U.S.A.
Distribution: Debian testing
Posts: 74

Rep: Reputation: 21
Okay, so add that one user to the group that owns the shared folder (assuming it is not root owned). then set permissions:
rw,rw,r
 
Old 05-07-2010, 04:25 AM   #4
Absent Minded
Member
 
Registered: Nov 2007
Location: Washington State U.S.A.
Distribution: Debian testing
Posts: 74

Rep: Reputation: 21
Quote:
Originally Posted by ytd View Post
Like... I'll create:

user1
user2
user3

I want user1 to be able to read, delete and write in that folder / directory.
I want user2 to have only read access and write access to the same folder / directory.
I want user3 to have only read access to the same folder / directory.

How do I do this ?

I want to do this NOT with samba, I want to do this with the ftp (vsftp).
I think you will need to use the "sticky" setting for this and I don't remember how to do that from the CLI.
 
Old 05-07-2010, 05:06 AM   #5
__raHulk
Member
 
Registered: Apr 2010
Location: Mumbai
Distribution: RHEL, Debian, Fedora, Ubuntu
Posts: 39
Blog Entries: 1

Rep: Reputation: 16
You can do this by using ACL's..

just type the following commands for user<x>

setfacl -d -m u:user1:rwx <directory-path>
setfacl -d -m u:user2:rw <directory-path>
setfacl -d -m u:user3:r <directory-path>

It will give rwx to user1, rw to user2 only r to user3 for that particular directory.
 
1 members found this post helpful.
Old 05-08-2010, 04:55 AM   #6
ytd
Member
 
Registered: Jan 2009
Posts: 205

Original Poster
Rep: Reputation: 31
Ok, and the chmod for that directory ? What it should be ? 644 ?
Because at the moment it's 777, I needed to chmod 777 so that the user can write at that moment so now I need to change back. But, change back to what ? 644 ?

http://www.javascriptkit.com/script/...chmodcal.shtml

the chmod calculator

Last edited by ytd; 05-08-2010 at 04:57 AM.
 
Old 05-09-2010, 10:52 AM   #7
__raHulk
Member
 
Registered: Apr 2010
Location: Mumbai
Distribution: RHEL, Debian, Fedora, Ubuntu
Posts: 39
Blog Entries: 1

Rep: Reputation: 16
Thumbs up

Yes ytd, you can change back the permission to 644 or whatever default permission you would like to give it to your directory. This permission will be applicable to all the users "other" than what is set by the setfacl command.

Cheers!!!
 
Old 05-11-2010, 02:10 AM   #8
ytd
Member
 
Registered: Jan 2009
Posts: 205

Original Poster
Rep: Reputation: 31
[root@xxx ~]# setfacl -d -m u:myuser:rwx /home/users/work/
setfacl: /home/users/work/: Operation not supported
[root@xxx ~]#
[root@xxx ~]#

Obs: "myuser" does exist and the path too

[root@xxx ~]# setfacl --help
setfacl 2.2.23 -- set file access control lists
Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ...
-m, --modify=acl modify the current ACL(s) of file(s)
-M, --modify-file=file read ACL entries to modify from file
-x, --remove=acl remove entries from the ACL(s) of file(s)
-X, --remove-file=file read ACL entries to remove from file
-b, --remove-all remove all extended ACL entries
-k, --remove-default remove the default ACL
--set=acl set the ACL of file(s), replacing the current ACL
--set-file=file read ACL entries to set from file
--mask do recalculate the effective rights mask
-n, --no-mask don't recalculate the effective rights mask
-d, --default operations apply to the default ACL
-R, --recursive recurse into subdirectories
-L, --logical logical walk, follow symbolic links
-P, --physical physical walk, do not follow symbolic links
--restore=file restore ACLs (inverse of `getfacl -R')
--test test mode (ACLs are not modified)
--version print version and exit
--help this help text
[root@xxx ~]#

[root@xxx ~]# uname -a
Linux xxx 2.6.9-55.0.9.ELsmp #1 SMP Thu Sep 27 18:28:00 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
[root@xxx ~]#
[root@xxx ~]# cat /etc/redhat-release
CentOS release 4.5 (Final)
[root@xxx ~]#
 
Old 05-11-2010, 02:15 AM   #9
ytd
Member
 
Registered: Jan 2009
Posts: 205

Original Poster
Rep: Reputation: 31
http://serverfault.com/questions/110...-not-supported

But I don't want to do this, it says that facl is slowing down the system. Is that right ?

"ACLs are disabled by default due to performance reasons. – grawity Feb 7 at 16:18"
 
Old 05-11-2010, 11:05 AM   #10
__raHulk
Member
 
Registered: Apr 2010
Location: Mumbai
Distribution: RHEL, Debian, Fedora, Ubuntu
Posts: 39
Blog Entries: 1

Rep: Reputation: 16
Quote:
Obs: "myuser" does exist and the path too
I understand that

And yes I must have told you earlier
If your filesystem is ext2, ext3 you need to remount it by enabling the acl.
http://articles.techrepublic.com.com...1-6091748.html
http://www.wlug.org.nz/AccessControlLists
 
1 members found this post helpful.
Old 05-11-2010, 11:28 PM   #11
ytd
Member
 
Registered: Jan 2009
Posts: 205

Original Poster
Rep: Reputation: 31
aight, but what's the inconvenience ? Is it true that by enabling the acl in the filesystem, will slow down the SO, or something liek that ?
 
Old 05-12-2010, 05:06 AM   #12
__raHulk
Member
 
Registered: Apr 2010
Location: Mumbai
Distribution: RHEL, Debian, Fedora, Ubuntu
Posts: 39
Blog Entries: 1

Rep: Reputation: 16
Dear ytd,

I could find no references which states that enabling up acl to your file-system slows it down. If you come across any such point in documentation then please share it so that u receive better help.
 
Old 05-12-2010, 05:31 AM   #13
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Lightbulb

Quote:
Originally Posted by ytd View Post
[root@xxx ~]# setfacl -d -m u:myuser:rwx /home/users/work/
setfacl: /home/users/work/: Operation not supported
We have to make an entry in /etc/fstab to enable ACLs in RHEL 4, however in RHEL 5 it is automatically enabled.

Please use the entry as similar to below in /etc/fstab
Code:
LABEL=/home             /home                   ext3    defaults,acl        1 2
and then run
Code:
mount -o remount /home
Hope this helps.
 
1 members found this post helpful.
Old 05-12-2010, 05:33 AM   #14
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by ytd View Post
aight, but what's the inconvenience ? Is it true that by enabling the acl in the filesystem, will slow down the SO, or something liek that ?
I am using ACLs for quite some time now on production server, never faced any issue.
 
1 members found this post helpful.
Old 05-13-2010, 01:50 AM   #15
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,348

Rep: Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749Reputation: 2749
Just to point out that acls are set 'on' on the partitions that exist during the install of RHEL5, BUT if you create a new partition from scratch after installation, acls will not be automatically set on. Use the tune2fs cmd or the options in /etc/stab to do that.
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
chmod 777 664 zerocool22 Linux - Server 7 06-03-2008 06:58 AM
Cannot set chmod for directory to 777 or 666 q.sa Linux - Software 6 07-19-2005 09:36 AM
user cant mount after chmod 777 /bin/mount misterwiddle Linux - General 2 04-06-2005 05:36 PM
CHMOD in shell : chmod 777 /usr/ <---is that right? cpanelskindepot Programming 5 07-16-2004 05:37 AM
chmod 777 /* ziggamon Linux - Newbie 2 09-25-2003 11:40 AM

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

All times are GMT -5. The time now is 06:35 AM.

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