LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 08-30-2003, 11:03 AM   #1
sikandar
Member
 
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255

Rep: Reputation: 30
Assign Privs to specific user


Is there any way to assign a file privs to a specific user instead of user, group or other. I want to assign rwx of a file to user abc?
 
Old 08-30-2003, 11:26 AM   #2
jalal
Member
 
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188

Rep: Reputation: 30
you can use "chown" to make that user the owner of that file.
 
Old 08-30-2003, 11:32 AM   #3
sikandar
Member
 
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255

Original Poster
Rep: Reputation: 30
No I don't want him to be owner. I just want to assign privs may be on rw of a files or directory to a specific user. As we do in the windows. But here in the chmod there is no parameter of a user name.
 
Old 08-30-2003, 09:55 PM   #4
jalal
Member
 
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188

Rep: Reputation: 30
oh, in that case, I guess you would need to check the ACL capabilities of your file system.
 
Old 08-30-2003, 10:33 PM   #5
LooseCanon
Member
 
Registered: Aug 2003
Location: Canada
Distribution: RH, Fedora, Debian
Posts: 128

Rep: Reputation: 15
What's "ACL capabilities" mean?
I too would like to know whether or not I could assign user "abc" full rwx permissions for a dir on my system. (SuSE 8.2)
 
Old 08-30-2003, 10:40 PM   #6
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
change the group. man chgrp.
chgrp [-R] user_name file/directory_name

the -R option flag is recursive for everything in the directory.

you may then have to chmod the file or directory so that the group has R-W-X permissions.
 
Old 08-31-2003, 01:16 AM   #7
sikandar
Member
 
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255

Original Poster
Rep: Reputation: 30
Actually the group usage had confused me. Let me know for every user we have to create a separate group? Main 100 users will have 100 groups.
 
Old 08-31-2003, 01:23 AM   #8
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
you said you wanted to have a specific user to have rwx access to certain files or directories. every user created is put in a group of his/her username. ie. user mr_hanky belongs to a group called mr_hanky already.

in terms of what you wanted, changing the group ownership of a file or directory to a username (who is automatically in a group named the same as the username) will do what you want.
 
Old 08-31-2003, 01:29 AM   #9
sikandar
Member
 
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255

Original Poster
Rep: Reputation: 30
So you mean that we can't give assign privs to a user but we can by granting privs ot the group the user belongs. Actually in the windows we assign privs to the user and also groups. Is this mandatory that each user will have him own group in Linux. If it is not mandatory then if there is a user without group then we can assign any privs except owner?

I just want to clear my confusion which a user face when he migrates from Novell or Win to Linux or Unix.
 
Old 08-31-2003, 01:34 AM   #10
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
if you don't want to change the owner of a file or directory, then a user can only be given exclusive permissions by changing the priveledges for the group owner of the file or directory. there isn't a distro i know of that by default doesn't automatically create group named the same thing as the username for a newly created user. on red hat, if you have a user named mr_hanky, you can't even unassign mr_hanky from the group mr_hanky.

although there is a thing called sudoers that will alter the sudo file, but i'm not sure it handles file permissions. plus the file has to be a certain syntax too. but just changing the group ownership of a file is way easier.

Last edited by megaspaz; 08-31-2003 at 01:36 AM.
 
Old 08-31-2003, 01:45 AM   #11
sikandar
Member
 
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255

Original Poster
Rep: Reputation: 30
I have just create a user in RH9 without private group but after creation the users group is assigned by default to this user as a primary group. When I tried to unassign the group it gave me a message that user must have member of a group. Ok what I got understanding that you can assign privs to a group and the assign the group to a user.

Say my user name is sikandar and have a file readme.doc so to grant rx privs to a user hayat I have to assign these privs to the group hayat so the user will get these privs. Am I right?
 
Old 08-31-2003, 01:57 AM   #12
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
let's see if i'm understanding you here. you created a user, sikander, and checking the groups sikander belongs to, you see the user sikander belongs to a group called sikander, right?
then you tried to take user sikander out of the group sikander and got an error, right?

but in general, you're second question is right. let's say you have a group project stored in the directory called "project_x". the owner of the directory and files in that directory is owned by user sikander and the group owner is sikander. if you want user mr_hanky to have full access to the directory you have to create a group (let's call it project_x) and put mr_hanky in that group. then change the group ownership of the directory and files in that directory to project_x. then you need to change (or make sure) the permissions are set to give the group of the directory full access. so the above scenario you'd change the group ownership and permissions using:

chgrp -R project_x project_x
chmod -R 775 project_x

but i thought you're original question was you wanted only a particular user to have access to a directory/files in which case, changing the group ownership to a user's name will work since that user will automatically belong to a unique group called the user's name.
 
Old 08-31-2003, 02:02 AM   #13
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
an example of what i thought you were asking would be this entry in my /etc/fstab file. here i say my windows partition will give full access to only root and my user, vjong. i do this by setting the gid=vjong which really means that my user vjong belongs to a group called vjong (by default) and i change the group ownership of the c partition to group vjong (where only user vjong belongs to the group vjong). the umask=0002 sets the permissions for owner to RWX, the group to RWX, and others to RX.

/dev/hda1 /winpar/winC vfat auto,owner,gid=vjong,umask=0002,exec,rw 0 0
 
Old 08-31-2003, 02:12 AM   #14
sikandar
Member
 
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255

Original Poster
Rep: Reputation: 30
Thanks megaspaz now I got the concept of privs assignment in the Linux OS.
 
  


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
assign new data partition to specific users wycolorado Linux - Newbie 2 01-01-2005 09:53 PM
how can you assign a password to a new user want2learn Linux - Security 2 09-30-2004 07:50 AM
How to assign a user to the particular partition ? sachinh Red Hat 3 07-26-2004 01:28 AM
How do you assign a process to a specific processor? ter_roshak Linux - General 1 12-19-2003 12:38 AM
mount fat32 in fstab in gentoo, user privs yowwww Linux - General 1 08-22-2003 04:36 PM


All times are GMT -5. The time now is 05:28 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration