How can you turn a root user into a normal user?
When I first set up ubuntu, I did most of my stuff in the root account. However, working exclusively in the root account is a bad idea. How can I turn my root account into a normal account without root privileges without deleting it?
The root user, or the superuser, in Linux is defined by the fact that it has user ID 0. So while it might be theoretically doable to "turn root user into a normal user", it would require some tricky editing of
/etc/shadow files to change the user ID of that user to some other number while simultaneously creating another user with user ID 0 (as Linux cannot properly function without a superuser). Also, you would need to change ownership of all files that you created as root to the new user ID anyway.
That basically equals to creation of a new user and moving all the files to a new user (with appropriate ownership change), so I would recommend it as a cleaner and "safer" solution.
- Create a new user (let’s call it
- Move all files and directories from
/home/newuser. Do not forget hidden files/directories as they contain config data, but leave out the files that are by default created in any new user’s directory – typically
.profile– they should stay in
- Change (recursively) ownership of all files and subdirectories in
newuser(and appropriate group).
- Some of your software may still not function properly, if it has absolute paths to previous location (ie.
/root) stored anywhere in its config. Grep (recursively, you can use
findfor this) all files in "dotted" subdirectories to check if any of them contains the path
/root– if yes, you should change it to