Granting Access Permission to a file to a specific user [closed] - linux

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
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

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

Related

In linux,who can be a root user? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I were using windows but now I am shift to unix like os sucn as linux,fedora .Now I am confused what is root in linux os?Please explain me.
Root user is also known as superuser in Linux-based OS. Basically, root user is granted all permission to do various task on that system. This includes adding/removing normal user account, managing services, changing ownership of files/folder and many more.
Normally, it is recommended for system administrator to create another normal user account to perform day-to-day operations while root account should only use when necessary. Once the system administrator has completed the necessary task, he/she will then revert back to their normal user account immediately. It is because a mistyped of command using root account might lead to wiping all data in the system!
For more information about root, you can visit here and here. Hope it helps.

Unix / Linux file permissions change for group preserve for user / world [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Is this possible?
I have an issue granting a user access to website via FTP. The user can access them but cant delete or edit the files. I would like to change the permissions for the group so any user belonging to the group can edit those files but preserve (keep) the permissions for user / world.
Thanks in advance,
Joseph Mituzas
The command
chmod g+r filename
will merely add group read permissions to the file and not affect user or world permissions. The command
chmod g=rw filename
will replace the current group permissions with read/write.
Neither of these commands will affect user and world permissions

How can I set the permission of a .key file to be only accessed by nginx [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a SSL certificate key in the directory /etc/nginx/key, how can I set permissions to allow only the nginx process to access the key file?
Make the Nginx user own it, and then set the permissions to only owner like so:
chown /etc/nginx/key nginxUser
chmod 400 /etc/nginx/key
I chose 400 because no one should need to write to your key. Note that root will still be able to read and write to this. Also, replace nginxUser with the user that runs nginx, I don't know who that is off the top of my head.
If you really want to do that, as root do the following:
chown nginx /etc/nginx/key
chmod 700 /etc/nginx/key

Linux User Previlages to change Owner/Group [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have some files, for which user is nobody and group is nogroup.
How do i set user privileges so that my user can change user and group to myself.
I don't want to do it using root or sudo.
Thanks
Only owner of a file/directory can change permissions of the file/directory.
root/sudo can access any file/directory and modify any file/directory 's permissions.
So to answer your question only the users nobody and root can change the file/directory 's permissions.
Let me brief the permissions part a bit for you:
1. Changing the ownership of any file or folder can only be done by root.
2. Only the owner of the file/folder can change the group.
So, in your case you'll need root or sudo rights for performing those actions.
Hope it helps

Why are Linux file permissions so primitive? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
Why are Linux file permissions still so primitive and is this likely to ever change?
Each file/dir can only have an owner and group. This seems to make the following things extremely difficult to implement:
How can you make a file read only and not delete-able, but still give that user permission to write to its directory?
How can you restrict directories to only certain users with out having to create a group for every possible combination of users required? And having done that its useless anyway because anyone who creates a file doesn't get it's permissions inheretted, so every user has to explicitly change the permissions on every file they make just so others can edit it.
I have found myself having to modify my programs to set the permissions of a file to the directory where it is saved to just to avoid user frustration.
How do you handle these sorts of things on desktop systems with non power users?
You can use the ACLs to have an advanced control on file and directory permissions.
An example (for Archlinux in this case) is here: https://wiki.archlinux.org/index.php/Access_Control_Lists
Have you tried using Access Control Lists ? see the setfacl command for an overview.
The issue of inheriting incorrect permissions is discussed at linuxquestions.org. Below is a summary of the proposed solution.
#mkdir tech
#chown root:tech tech/
#chmod g+s tech/
#chmod 0750 tech/
#setfacl -d -m g:techAdmin:rwx tech/
#setfacl -m group:techadmin:rwx tech/
The above will create a new directory tech which is owned by the tech group. The user group techAdmin will have access to read/write/create and tech group users will have read access.

Resources