linux 系统账户 和 普通账户 的区别

最近使用 useradd -r 选项进行创建账户,用于测试,对-r 选项不是很明白,下面记录一些调研的过程:

       -r, --system
           Create a system account.

           System users will be created with no aging information in /etc/shadow, and their numeric identifiers are chosen 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 a 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.


When you are creating an account to run a daemon, service, or other system software, rather than an account for interactive use.

Technically, it makes no difference, but in the real world it turns out there are long term benefits in keeping user and software accounts in separate parts of the numeric space.

Mostly, it makes it easy to tell what the account is, and if a human should be able to log in.



posted @ 2019-12-06 18:08  xuyaowen  阅读(...)  评论(...编辑  收藏