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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-30-2003, 11:03 AM
|
#1
|
Member
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255
Rep:
|
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?
|
|
|
08-30-2003, 11:26 AM
|
#2
|
Member
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188
Rep:
|
you can use "chown" to make that user the owner of that file.
|
|
|
08-30-2003, 11:32 AM
|
#3
|
Member
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255
Original Poster
Rep:
|
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.
|
|
|
08-30-2003, 09:55 PM
|
#4
|
Member
Registered: Aug 2003
Location: .bh
Distribution: Gentoo
Posts: 188
Rep:
|
oh, in that case, I guess you would need to check the ACL capabilities of your file system.
|
|
|
08-30-2003, 10:33 PM
|
#5
|
Member
Registered: Aug 2003
Location: Canada
Distribution: RH, Fedora, Debian
Posts: 128
Rep:
|
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)
|
|
|
08-30-2003, 10:40 PM
|
#6
|
Senior Member
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054
Rep:
|
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.
|
|
|
08-31-2003, 01:16 AM
|
#7
|
Member
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255
Original Poster
Rep:
|
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.
|
|
|
08-31-2003, 01:23 AM
|
#8
|
Senior Member
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054
Rep:
|
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.
|
|
|
08-31-2003, 01:29 AM
|
#9
|
Member
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255
Original Poster
Rep:
|
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.
|
|
|
08-31-2003, 01:34 AM
|
#10
|
Senior Member
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054
Rep:
|
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.
|
|
|
08-31-2003, 01:45 AM
|
#11
|
Member
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255
Original Poster
Rep:
|
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?
|
|
|
08-31-2003, 01:57 AM
|
#12
|
Senior Member
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054
Rep:
|
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.
|
|
|
08-31-2003, 02:02 AM
|
#13
|
Senior Member
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054
Rep:
|
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
|
|
|
08-31-2003, 02:12 AM
|
#14
|
Member
Registered: Aug 2003
Distribution: Linux AS & RH 9
Posts: 255
Original Poster
Rep:
|
Thanks megaspaz now I got the concept of privs assignment in the Linux OS.
|
|
|
All times are GMT -5. The time now is 11:25 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|