Unix or Linux commands for changing user rights

Recently I received the question via email — “…How do I change user rights under UNIX? I am using Red Hat Enterprise Linux and my background includes Windows network…


This is one of the fundamental questions asked by new Linux system administrators. As many of you may already know, both Linux and Windows are multi-user and control access to resources is based upon user id or usernames. Further users grouped into groups for ease of management and security.

However, Linux (and UNIX) stores and process user database in different format.

The root user

  • The root user is the super user.
  • The root user can control entire Linux system including files, process, applications etc. The root user has full access to system.
  • You should not use root for day-to-day tasks as root has full system access.
  • Never ever, give root password to anyone.

For more information see What defines a user account?

User database

Group database

UNIX/Linux User rights

There are two types of user rights (traditional):

  • File level user rights or permissions granted using chmod and chown command
  • Administrative (root) level rights granted using sudo.

If you type the following command:

$ ls -l

You’ll see something like the following:

-rw-r--r-- 1 vivek webusers 14814 2006-07-26 13:25 working-nixcraft.txt

Look at 3rd, 4th and last columns.

  • vivek is username or the owner of the file (userid)
  • webusers is group name, so all users in webusers can access file working-nixcraft.txt
  • working-nixcraft.txt is the file name.

As the root user you can change or setup user file related rights/permission using chmod and chown command.

Task: change file owner and group

Consider following example:

$ ls -l foo.txt


-rw-r--r-- 1 vivek webgroups 8 2006-08-08 17:57 foo.txt

Change files ownership to tony user:

# chown tony foo.txt
# ls -l foo.txt


-rw-r--r-- 1 tony webgroups 8 2006-08-08 17:57 foo.txt

Change foo.txt group to ftpusers:

# chown tony:ftpusers foo.txt
# ls -l foo.txt


-rw-r--r-- 1 tony ftpuseers 8 2006-08-08 17:57 foo.txt

You can also operate on files and directories recursively using -R option. For example setup /var/www/html ownership to user lighttpd including subdirectories:

# chown -R lighttpd /var/www/html

Task: change files access rights/permissions

You need to use chmod command. Please refer the old article – how Linux file permissions work.

Task: Grant administrative rights to a normal user

You need to use sudo tool. It allows a permitted user to execute a command as the superuser or another user, as specified in the /etc/sudoers configuration file. Please refer previous article for more information.

A note for Ubuntu Linux users

You can use chmod and chown command to setup user rights. Make sure you prefix all commands with word (command) sudo:

$ sudo chown tony:ftpusers foo.txt

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

12 comments… add one
  • chadrick Aug 9, 2006 @ 20:50

    This stuff is good for noobs. I wish I had read something like earlier


  • Matey Nov 28, 2008 @ 15:42

    I’d like to know if there is a quick way to Decrease a user’s rights.
    I have a user called user3 but I dont want him to be able to edit or change files under /etc or other system files.
    In other words I would like to change rights on the user instead of files/folders.
    Is it possible?

    Thank You in advance!

  • Sandeep hande Mar 6, 2009 @ 21:09

    i have a user user1 to which i want to give Full admin right like root

  • Richard Jul 6, 2009 @ 20:50

    I would still like to know what rights I need (not root) to:

    * monitor the syslog (via remote ssh ability)
    * monitor the disks (via remote ssh ability)
    * monitor the ProcessUtilization (via remote ssh ability)

  • Ron Nov 30, 2009 @ 7:52

    very clear, tnkx!

  • Jonathan Dec 15, 2009 @ 17:37

    I have a problem…I accidentally typed in ‘chown -R root:www-data *’. I now have 403 Forbidden Errors. How can I redo this?

  • Vaibhav May 25, 2010 @ 8:02

    I have created user using useradd command. But the created user is not having the full rights. What is the solution for that?

  • Vinny Benson Mar 13, 2011 @ 16:12

    is there something like ” sudo chown vinny * “, cos everytime i go to edit a file, i have to chmod it first

    • Ant Apr 15, 2011 @ 14:41


      When you do “sudo chown vinny”, you’re giving rights to that user based on your chmod settings for user. So even thought you specify “vinny” as being the owner, you must still specify the “user” permissions.

      chmod -R /directory/somefolder u+rwx i believe this is the correct syntax for changing the “user” to allow read write and execution of all files in somefolder, that “user” being “vinny”.

  • Benny Feb 10, 2012 @ 20:37


    How do I set user rights for a local linux user to rwx on a CIFS mounted windows share.
    All I see is root with full rights. but my other user has no rights.
    Please advice.

  • amit Jan 16, 2013 @ 14:26

    hows the normal user change our password

    • alex Aug 16, 2013 @ 4:55

      passwd “username”
      *then the system prompts you for the current password and then the new password

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.