LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Assign Privs to specific user (http://www.linuxquestions.org/questions/linux-software-2/assign-privs-to-specific-user-87356/)

sikandar 08-30-2003 11:03 AM

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?

jalal 08-30-2003 11:26 AM

you can use "chown" to make that user the owner of that file.

sikandar 08-30-2003 11:32 AM

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.

jalal 08-30-2003 09:55 PM

oh, in that case, I guess you would need to check the ACL capabilities of your file system.

LooseCanon 08-30-2003 10:33 PM

What's "ACL capabilities" mean? :confused:
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)

megaspaz 08-30-2003 10:40 PM

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.

sikandar 08-31-2003 01:16 AM

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.

megaspaz 08-31-2003 01:23 AM

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.

sikandar 08-31-2003 01:29 AM

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.

megaspaz 08-31-2003 01:34 AM

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.

sikandar 08-31-2003 01:45 AM

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?

megaspaz 08-31-2003 01:57 AM

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.

megaspaz 08-31-2003 02:02 AM

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

sikandar 08-31-2003 02:12 AM

Thanks megaspaz now I got the concept of privs assignment in the Linux OS.


All times are GMT -5. The time now is 07:17 AM.