[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

linux

Posted on 2014-08-12
7
Medium Priority
?
646 Views
Last Modified: 2014-09-01
how do i set permissions to a folder for 1 user in linux to read the files within the folder?
0
Comment
Question by:Jack_son_
7 Comments
 
LVL 14

Assisted Solution

by:comfortjeanius
comfortjeanius earned 332 total points
ID: 40256629
You read this link: How to Manage File and Folder Permissions in Linux and Linux Permissions  This will give you a better understanding.

sudo chmod 400

Open in new window

0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 664 total points
ID: 40256727
A user might be:

- owner: owns a folder or a file
- from same group of users of the owner of folder or file
- others: none of above

perms are: read (r), write (w), or execute (x).

when folders or files are created, in general, gives read to all.

if you want to restrict perms to a particular user, then change ownership to that user and revoke perms:

e.g.

chown user1 /path/to/folder

chmod 700 /path/to/folder
0
 
LVL 40

Assisted Solution

by:omarfarid
omarfarid earned 664 total points
ID: 40256778
by the way giving perms on folder on folder does not mean giving perms on files under it.

you may need to change ownership and perms of files as well
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Assisted Solution

by:Sandy
Sandy earned 668 total points
ID: 40257681
Would be great if you will explain what exactly you need.. for the answer of your question

1. Add user to folder as owner

#chown user folder

2. Provide read access by remoing other access.

#chmod u+r,go-rwx folder

TY/SA
0
 

Author Comment

by:Jack_son_
ID: 40257960
okay thanks; also what is the command just to add the user to a group?
0
 
LVL 13

Assisted Solution

by:Sandy
Sandy earned 668 total points
ID: 40257974
usermod -g <primary_group_name> -G <secondary_group_name> user

-g == whenever you want to assign primary group membership
-G == to add a user as a member of more than one group.

TY/SA
0
 
LVL 31

Accepted Solution

by:
serialband earned 336 total points
ID: 40261087
Those are the old standard POSIX permissions that don't easily allow fine tuning down to a single user.  Newer linux has more versatile ACLs with getfacl and setfacl to better fine tune permissions.  If your linux supports it, it's a bit easier to assign individual permissions without assigning entire groups.

https://wiki.archlinux.org/index.php/Access_Control_Lists

getfacl /Path/to/FolderOrFile

setfacl -m "u:USER_ACCOUNT_NAME:rw-" /PATH/or/File
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to demonstrate how we can use conditional statements using Python.
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month19 days, 5 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question