I have given a normal user root permissions on Linux by using this command:

usermod -u 0 -o username

How can I go back and make the user a normal user again?


# grep Jack /etc/passwd
Jack :x:500:500::/home/Jack:/bin/bash
# usermod -u 0 -o Jack
Jack :x:0:500::/home/Jack:/bin/bash
  • 2
    Did you try usermod -u 500 -o Jack? Playing with the 0 user is not a good idea. – terdon Sep 19 '15 at 12:28
  • 1
    Has your /etc/passwd still a normal root: record?       A side note: don’t include spaces in the username field. – Incnis Mrsi Sep 19 '15 at 14:32
  • Similar: How do I change UID of 0 from non-root user? – Scott Sep 20 '15 at 5:37

Just run usermod -u 500 -o username to change the user ID back to 500.

Note that changing a user ID doesn't “give the user root permissions”. What it actually does is to make the user name another name for user 0, i.e. the root user. A user is defined by the user ID. It's possible, but very rarely useful, to have multiple names for the same user ID. Furthermore, using the root account (i.e. user ID 0, by whatever name) for normal work is a bad idea: you increase the risk of breaking your system, you don't actually get significant benefits, and some programs will flatly refuse to work.

To “give a user root permissions”, the most common method is to use sudo. Run the program visudo and add a line to the file like

jack ALL = (ALL:ALL) ALL

Then the user jack will be able to run commands as root by adding sudo in front of them, or using graphical sudo wrappers.

Note that a lot of software doesn't support special characters such as spaces in user names. The user name (the one in the first column of /etc/passwd is a machine-parseable name and should only contain ASCII letters and digits. The fifth field contains the full name, i.e. the human-readable name.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.