Users, Groups, And Permissions In Linux

Article by:
Date Published:
Last Modified:


User Manipulation

To add a user called bart:

$ sudo useradd bart

Group Manipulation

To add a pre-existing user called bart to the group simpsons:

$ groupadd -g simpsons bart


File and directory permissions are set in Linux with pe

chmod is the default UNIX tool for modifying file and directory permissions.

Group Permissions

To allow anyone in the same group to read, write or execute files (only files which are currently executable by a user), as well as allow them to read contents of all sub-directories:

$ sudo chmod -R g+rwX my_parent_dir/

To change permissions recursively on a group of files, use:

$ sudo chmod -R <mode flags> my_directory/

Using a capital X instead of a lower-case x results in the executable bit only being set if the file is a directory or the executable bit is already set for some user. This is useful when applying changes to multiple files (using the recursive option -R), as you usually don’t want to make things such as text files executable!


You can recursively change the ownership of all files and directories with the -R flag:

chown -R myuser:mygroup .

If the user or group contains a space, you must quote it:

chown -R "my user":"my group" .


Geoffrey Hunter

Dude making stuff.

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License .

Related Content:


comments powered by Disqus