Granting Access Permission to a file to a specific user

Alison Lee picture Alison Lee · Feb 20, 2012 · Viewed 74.9k times · Source

In linux, how can I give access permissions to a file/folder to a specific person. In other words suppose I want to allow only and only user fred to be able to read a file, then how do I do that?

Note that I know about chmod and all, but Linux doesn't seem to provide a fine tuned access permission control where you can specify the access control of one specific user.

Thanks, Alison

Answer

Daniel picture Daniel · Feb 20, 2012

Unix uses discretionary access control (DAC) for permissions and access control. For better security SELinux provide mandatory access control (MAC). This is consider difficult for administrators to set up and maintain.

Use commands:

chown user_name file
chown user_name folder
chown -R user_name folder #recursive