LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Change the permission of the folder or file for a specific user (https://www.linuxquestions.org/questions/linux-newbie-8/change-the-permission-of-the-folder-or-file-for-a-specific-user-4175421950/)

it-secret 08-13-2012 11:37 PM

Change the permission of the folder or file for a specific user
 
Hello evreyone

I have a folder or a specific file name Suppose text

P asked me to give permissions to this file for user in sys Suppose I have named jhon

And allow him to read and write rw

P What is it required that the bearing!

If you want to change my terms of reference for the total or the owner of the file or the other about it the next

chmod g rw text

I hope it's origin had to add the powers of a given system's Yoezer

Greetings to you

roger_heslop 08-14-2012 12:34 AM

I think your asking how to change users of a specific file or directory as opposed to permissions.
Just in case, changing permissions for an owner is done like this:
Code:

chmod u+rw fileName
Changing the actual owner might look something more like this:
Code:

chown john fileName
Finally, if you need to change the owner and group, use the following
Code:

chown john:groupName fileName

it-secret 08-14-2012 12:47 AM

thx bro

but if

drwxr-xr-x. 2 root admins 4096 Aug 14 08:08

if jhon member of admins , and i don't want he read or write to file

thx again

jschiwal 08-14-2012 01:38 AM

A) Then why is jhon a member of admins? Or why was admins chosen as the file's group? Use a different group.

B) Use file ACLs. Create an file acl for the text file for user jhon and deny access. In Linux if a user is denied access explicitly then group or other permissions won't increase access.

For example a file text.txt owned by jhon, and the file's group is admins. If the files permissions are 044, then jhon won't have access even though other members of admins do. In this example, jhon will be able to change permissions of the file since he is the owner. This is why I suggested using acls instead.

You will need to verify this yourself. I'm on a tablet away from my computer.

Also note that this behavior is Linux specific, opting for most restrictive. Another difference is that Linux doesn't allow suid scripts. Or rather that Linux ignores the suid bit for scripts.


All times are GMT -5. The time now is 09:47 AM.