linux - enabling system user to login?
You can not log in as user
because it is a system account, which is specified by the --system
option. System accounts are for daemons or services, not for human users, and are therefore given /bin/false
for login shell. If you enter grep '^user' /etc/passwd
, you will get something like this:
user:x:117:123::/opt/user:/bin/false
To allow user
to log in, you can use usermod to change its login shell to bash:
usermod -s /bin/bash user
Alternatively, you can also edit /etc/passwd
by hand. You may also want to make some other changes to user
's UID, GID, and home directory location.
It might be that the user was created without the -m flag.
-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.
-m, --create-home
Create the user's home directory if it does not exist. The files and directories contained in the skeleton directory (which can be defined with the -k option) will be copied to the home directory.
useradd will create the home directory unless CREATE_HOME in /etc/login.defs is set to no.
Edit: Also, see this answer to another question.