Change permissions and ownership of file/folder via command line

The commands for modifying file permissions and ownership are:

  • chmod – change permissions

  • chown – change ownership.

A new folder was created on a data partition called /DATA/SHARE

# sudo chmod -R ugo+rw /DATA/SHARE

The breakdown of the above command looks like:

  • sudo – this is used to gain admin rights for the command on any system that makes use of sudo (otherwise you'd have to 'su' to root and run the above command without 'sudo')

  • chmod – the command to modify permissions

  • -R – this modifies the permission of the parent folder and the child objects within

  • ugo+rw – this gives User, Group, and Other read and write access.


Changing the ownership of a file or folder is equally as simple:

chown -R "Username" /DATA/SHARE        (Replace Username with real username to whom you want to give ownership)

Let's break this down.

  • sudo – admin rights must be used since we are dealing with a folder that belongs to another user

  • chown – the command for changing ownership

  • -R – the recursive switch to make sure all child objects get the same ownership changes

  • Username – the new owner of the folder

  • /DATA/SHARE – the directory to be modified

  • 0 Users Found This Useful
Was this answer helpful?
Related Articles
Copyright © 2024 Temok Technologies. All Rights Reserved.
Positive SSL