Close Menu
    What's Hot

    The Compatibility Gap: What Modern Systems Actually Do to Legacy Interactive Content

    April 8, 2026

    XML::LibXML::Parser

    April 8, 2026

    XFBURN

    April 8, 2026
    Facebook X (Twitter) Instagram
    Command Linux
    • About
    • Man Pages
    • Arch Linux
    • Statistics
    • How to
      • Q&A
    • OS
      • Windows
    • Blog
      • Featured
    • MORE
      • Easter Eggs
      • IP Address
    • Write For Us
    • Contact Us
    Command Linux
    Home - Q&A - How to Change Owner of Folder Linux

    How to Change Owner of Folder Linux

    WillieBy WillieFebruary 19, 2026No Comments4 Mins Read

    Every item on a Linux filesystem—whether a file, folder, or directory—carries metadata about who controls it. This metadata includes a user, a group, and a set of access rights. Knowing how to change owner of folder Linux properly is a skill every administrator needs.

    Reasons You Might Need to Change Owner of Folder Linux

    Scenario Explanation
    Restricting access A folder must only be reachable by one specific account
    Employee departure Data folders must be reassigned to revoke old privileges
    Script execution Bash or Python programs may require read/write access, so the correct proprietor must be set
    Network transfers Moving data across machines often results in mismatched ownership

    How to Check Current Folder Ownership in Linux

    Before you change owner of folder Linux, check who currently controls the target path:

    $ ls -l MyProjectData
    $ ls -l -d MyProjectData

    The output displays three key columns:

    Column What It Shows
    First (e.g., drwxr-xr-x) Permission flags
    Second (e.g., alex) The user who owns the folder
    Third (e.g., alex) The group tied to the folder

    Suppose user alex and group alex control MyProjectData along with its contents.

    Note: The -d flag tells ls to display information about the directory itself, not its contents.

    The chown Utility: Syntax Overview

    The chown command belongs to the GNU Coreutils package. Its job is reassigning user and group ties on files and folders.

    $ chown [OPTION]... [OWNER][:[GROUP]] FILE...
    Component Meaning
    OWNER The new user to assign
    :GROUP The new group to assign (preceded by a colon)
    FILE One or more target files or folders

    Identifying Available Users and Groups

    Confirm which accounts and groups exist on your machine. Print all registered accounts:

    $ getent passwd

    Print all registered groups:

    $ getent group

    If the desired account does not exist yet, create one with adduser:

    $ sudo adduser mentor
    $ sudo adduser mentor sudo

    This registers a fresh account called mentor and grants it elevated privileges.

    How to Change Owner of Folder Linux with chown

    To change owner of folder Linux from alex to mentor:

    $ sudo chown mentor MyProjectData

    Verify the result:

    $ ls -l -d MyProjectData

    The second column should now read mentor.

    Warning: Only a root or sudo-enabled account can run chown. Running it without sudo on folders you do not own will return a permission denied error.

    Modifying Both User and Group at Once

    Reassign both the user and the group in a single step:

    $ sudo chown mentor:mentor MyProjectData

    Both the owner and the group fields for MyProjectData will now display mentor.

    Tip: Use the OWNER: format (colon, no group name) to set the group to the login group of the specified user automatically.

    Applying Ownership Changes Recursively to All Nested Contents

    The parent folder might belong to mentor, but items inside it could still carry old assignments. Propagate the update through every subfolder and file with the -R flag:

    $ sudo chown -R mentor:mentor MyProjectData

    Confirm by listing both the parent and its contents:

    $ ls -l -d MyProjectData
    $ ls -l MyProjectData

    Every entry should now reflect mentor as the user and group.

    Note: The -R flag follows directory trees but does not cross filesystem boundaries by default. Add --no-preserve-root only if you fully understand the consequences.

    Quick Reference for chown Commands

    Action Command
    Reassign only the user sudo chown mentor FolderName
    Reassign user and group together sudo chown mentor:mentor FolderName
    Reassign recursively through all nested items sudo chown -R mentor:mentor FolderName

    If you also need to adjust read/write/execute bits separately, look into the chmod command, which handles permission modes rather than ownership. For a deeper look at how the chown system call works at the kernel level, the Linux man pages offer thorough documentation.

    FAQs

    chown stands for “change owner.” It is a command-line utility that reassigns user and group ownership on files and directories in Linux and other Unix-like systems.

    No. Ownership changes require root privileges. Run chown with sudo, or switch to the root account first using su -.

    Add the -R flag to the chown command. For example: sudo chown -R newuser:newgroup /path/to/folder. This applies the change to all subfolders and files.

    chown changes who owns a file or folder (user and group). chmod changes what the owner, group, and others can do with it (read, write, execute permissions).

    Yes. By default, chown changes ownership of the target file a symlink points to, not the symlink itself. Use the -h flag to change ownership of the symlink instead.

    Willie
    • Website

    Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.

    Related Posts

    How To Use The SSH Login Command

    April 7, 2026

    How to Apt Install Java on Ubuntu (JRE and JDK)

    March 18, 2026

    Echo Color Code in Linux

    March 16, 2026

    How To Change Permissions Of A File In Linux

    March 12, 2026
    Top Posts

    Top Linux Desktop Environments In 2026

    January 8, 2026

    EVP_DigestInit

    February 21, 2026

    How To Fix Msvcp110.dll Error

    March 16, 2026

    FSTAB

    March 22, 2026
    • Home
    • Contact Us
    • Privacy Policy
    • Terms of Use

    Type above and press Enter to search. Press Esc to cancel.