Restore Nobody user after deletion

Hi everyone! Recent linux-user here.

I deleted the Nobody user, without knowing about its importance. I found a post related to this problem but the information linked there from the archive is lost.

Could anyone help me on how to restore the Nobody user?


Add it back with useradd --help.
It should look like this:


So you need to tell useradd to use UID and GID of 65534, shell is /usr/bin/nologin, don’t create home. And that “Nobody” (capital N) field is called GECOS field/comment.

from reading
man useradd
I pieced together this command:

useradd --gid 65534 --uid 65534 --no-create-home --shell /usr/bin/nologin Nobody

or perhaps rather this:

useradd --gid 65534 --uid 65534 --no-create-home --shell /usr/bin/nologin nobody

I can’t figure out how to set the GECOS field - but the user name needs to be lowercase “nobody”.

run it with sudo

then check whether /etc/passwd and /etc/group look like @zbe said

-c, --comment COMMENT         GECOS field of the new account

You can probably just ignore this.

Thank you!
I’m sure I’m not blind, but being pretty tired may explain me having missed it.

Hi, I deleted mine from the UI w/o knowing its important. I tried restoring it using the useradd above but I am getting : useradd: user ‘nobody’ already exists. I am having no issues so far other than the fact the user is gone.