LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 10-28-2011, 07:28 PM   #1
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Rep: Reputation: Disabled
How do I change user rights for speciffic users?


I have several users on a linux machine. I want them to have the combination I see fit for certain files REGARDLESS of what or who owns them.

For example, if I have the users alpha, beta and gamma on a machine and the file test owned (for exemple) by alpha, I want it to be able to give every single user a combination of rights of my choosing like in this example:
alpha rwx
beta r--
gamma --x

although beta or gamma do not own the file.

Please tell me how to do this recursively on a directory with lots of files inside it.

And please tell me how to do the same thing with groups.

Last edited by venom4u31; 10-28-2011 at 07:29 PM. Reason: sorry for the typo in the title
 
Old 10-28-2011, 08:35 PM   #2
KenJackson
Member
 
Registered: Jul 2006
Location: Maryland, USA
Distribution: Fedora and others
Posts: 757

Rep: Reputation: 145Reputation: 145
The traditional UNIX and Linux way of controlling group access is with groups. It's true that they don't have quite the level of micromanagement that you describe because the UNIX/Linux world comes from less of a micromanagement way of thinking than some other OSes.

Implementing the group control is fairly straightforward. Create a new group, let's name it greek since the users have greek usernames, and add those users to the group.
Code:
groupadd greek
for u in alpha beta gamma; do usermod -a -G greek $u; done
Now change the group to greek for each file in and below /some/path.
Code:
chgrp -R greek /some/path

But, alas, you are posting from Windows7 with a question that plays to a Windows strength, perhaps for the purpose of showing that Windows has some virtue after all. And many would argue that ACLs are a valuable feature that Windows has had for a while.

But Linux does have ACLs now. I have no reason to use them, but I think they will let you do what you describe. There's a chacl command that also has a -r switch for recursion.

See man chacl for help.
 
Old 10-28-2011, 08:44 PM   #3
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,279

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
You maybe interested about ACL:
Code:
setfacl -m u:alfa:rwx,u:beta:r,u:gamma:x /path/to/file/test
You can use wildcards as usual for all files in directory and -R option for recursive operation. More info you can find in manual. The file system must support this feature. ext4 with 'acl' option works.
 
Old 10-29-2011, 03:42 AM   #4
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Original Poster
Rep: Reputation: Disabled
I think I have ext3 on my machine so chacl or setfacl won't work (I tried, they did not).

Anyway, you're telling me that I'm bound by the bureaucracy of assigning users to groups, then changing the group owners for all the files then changing the rights with chmod g=--x (for example) and repeating this procedure for every user? Group implementation may be a nice addition to linux, but it shouldn't force root to deal with it. Root should force linux to do whatever it wants (including not dealing with groups).

What I mean: Isn't there a command like this: <command> [username/userid] [rights] [files_in_question] that changes the rights for the files in question only for the mentioned users?
 
Old 10-29-2011, 06:51 AM   #5
eSelix
Senior Member
 
Registered: Oct 2009
Location: Wroclaw, Poland
Distribution: Arch, Kubuntu
Posts: 1,279

Rep: Reputation: 320Reputation: 320Reputation: 320Reputation: 320
It is supported for ext2, ext3 and raiserfs also. You can manually enable this by adding "acl" option to mount command or fstab.
Quote:
Isn't there a command like this
Yes it is. We provided that commands for you. Someone needed this feature ealier and some others created it. But it havily depends on used filesystem so not every is capable of that.

Last edited by eSelix; 10-29-2011 at 07:01 AM.
 
Old 11-01-2011, 12:14 PM   #6
venom4u31
Member
 
Registered: Oct 2011
Distribution: Debian 6
Posts: 47

Original Poster
Rep: Reputation: Disabled
Finally I solved it!!!! The solution sounds like this:

1: make sure you have acl installed; if not,
Code:
apt-get install acl
(sudo is not necessary since wanting to install something like acl implies you are logged in as root)

2: find out the partition you want acl active on (it's found on /dev/ and it has the form hda1, hda2, sda1, sda2) and mount acl on it using this command:
Code:
mount -o remount,acl /dev/hda6
where you can replace hda6 with any other partition.

And that worked for me. The command setfacl does what I wanted to achieve and getfacl makes sure it worked.

I wrote that so future google wanderers might get intel faster. Further reference: http://www.debianhelp.co.uk/acl.htm
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] User permissions & users rights smilemukul Linux - Newbie 1 08-09-2010 02:53 PM
Need a user friendly tool for users to change ldap userpassword Niceman2005 Linux - Software 3 08-27-2007 08:54 PM
change user and list of users accounted on system Mangenius Linux - Newbie 2 01-25-2007 01:28 PM
giving user ability to change all users passwords mp5 Linux - Newbie 1 06-28-2004 08:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:28 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