How to add “system” local user like thesql or tomcat

useraddusers

My system has a lot of users, I'v never created, like mysql or tomcat. These users have no home directories inside /home

Obviously, a daemon programs run under these users.

What is the term for such users?

How to create my own user of such kind? For example, I wish to create a user for deluged, but I don't want to create and remember a password for it and also don't want to allow somebody to login with this user from console.

How to accomplish?

Best Answer

You can give useradd the -r or --system flags to tell it you want such a user (a system user as you already called it). Here's an excerpt from my system's man page:

-r, --system
       Create a system account.

       System users will be created with no aging information in
       /etc/shadow, and their numeric identifiers are choosen in the
       SYS_UID_MIN-SYS_UID_MAX range, defined in /etc/login.defs, instead
       of UID_MIN-UID_MAX (and their GID counterparts for the creation of
       groups).

       Note that useradd will not create a home directory for such an
       user, regardless of the default setting in /etc/login.defs
       (CREATE_HOME). You have to specify the -m options if you want a
       home directory for a system account to be created.

Though you can make any user unable to login from the console by setting their shell to /bin/false or /sbin/nologin or something like that. You can do that with -s to useradd or you can change an existing user with chsh -s /sbin/nologin for example.