Custom name of root user

0

Obviously, the root user's username is root. Is there a way to change it's username to something else while keeping it's root powers? Example: Change it to webadmin on a http server.

Half-Life

Posted 2020-02-16T16:18:29.380

Reputation: 3

Did you see How do you rename root? on Unix & Linux stackexchange.

– lx07 – 2020-02-16T16:35:53.823

Oh shoot, I couldn't find that, thanks. If you make that an answer I'll accept it. – Half-Life – 2020-02-16T16:44:42.707

Answers

0

I would advise against it, because some software may depend on there being an account named root. But if you insist:

  • Boot a live-distribution from an USB-stick.
  • Mount the root filesystem.
  • usermod --root /path/to/mounted/filesystem --login newname root.

The booting to a live-distribution is necessary because usermod won't let you change the username of an user that has running processes. Note that the above command doesn't change anything else besides the name. You might want to add --home /path/to/new/home --move-home and you should probably rename the mail spool. See man usermod for further information.

tastytea

Posted 2020-02-16T16:18:29.380

Reputation: 152