Linux - SoftwareThis 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.
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.
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.
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.
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.
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.
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?
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:
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.
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.