web*_*sen 5 linux login user-management
我在我的服务器上运行了一些 Java 应用程序,我对其进行了设置,以便使用 nologin 用户 ID 执行每个应用程序。
现在,当我添加用户时
/usr/sbin/useradd -g $MY_GROUP -s /sbin/nologin -d /home/$MY_USER $MY_USER
Run Code Online (Sandbox Code Playgroud)
我想知道是否有关于这些用户是否需要一个家以及他们是否需要的约定——我应该把他们放进去吗?
/home/abc
Run Code Online (Sandbox Code Playgroud)
或进入
/usr/local/abc
Run Code Online (Sandbox Code Playgroud)
我已经看到它以两种方式完成
在类似 RedHat 的系统上,您可以使用 \xe2\x80\x98-r\xe2\x80\x99 选项将用户创建为系统帐户:
\n\n\n\n\nRun Code Online (Sandbox Code Playgroud)\n-r This flag is used to create a system account. That is, a user with a UID lower than the value of UID_MIN defined in\n /etc/login.defs and whose password does not expire. Note that useradd will not create a home directory for such an user,\n regardless of the default setting in /etc/login.defs. You have to specify -m option if you want a home directory for a system\n account to be created. This is an option added by Red Hat\n
根据您的发行版上是否提供此选项,这可能就是您想要的。
\n