Posted on 2014-08-12
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?
Question by:Jack_son_
    LVL 14

    Assisted Solution

    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

    LVL 40

    Assisted Solution

    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:


    chown user1 /path/to/folder

    chmod 700 /path/to/folder
    LVL 40

    Assisted Solution

    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
    LVL 13

    Assisted Solution

    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


    Author Comment

    okay thanks; also what is the command just to add the user to a group?
    LVL 13

    Assisted Solution

    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.

    LVL 27

    Accepted Solution

    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.

    getfacl /Path/to/FolderOrFile

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

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Little introduction about CP: CP is a command on linux that use to copy files and folder from one location to another location. Example usage of CP as follow: cp /myfoder /pathto/destination/folder/ cp abc.tar.gz /pathto/destination/folder/ab…
    SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    732 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now