
このユーザーは次のコマンドを使用して作成されました:
sudo adduser --system --home=/opt/user --group user
しかし、今、そのユーザーがログインできるようにしたいのです。 を使用してそのユーザーになることができますsudo
が、パスワードを使用して直接ログインすることも望んでいます。次のコマンドを使用してみました:
sudo passwd user
ユーザーのパスワードを追加できます。ログインしようとすると、ログインはできますが、すぐに終了します。
答え1
user
オプションで指定されているシステム アカウントであるため、としてログインすることはできません--system
。システム アカウントはデーモンまたはサービス用であり、人間のユーザー用ではないため、/bin/false
ログイン シェルに与えられます。 と入力するとgrep '^user' /etc/passwd
、次のような結果が表示されます。
user:x:117:123::/opt/user:/bin/false
user
ログインを許可するには、usermod を使用してログイン シェルを bash に変更できます。
usermod -s /bin/bash user
あるいは、手動で編集することもできます。の UID、GID、ホーム ディレクトリの場所/etc/passwd
に他の変更を加えることもできます。user
答え2
ユーザーが -m フラグなしで作成された可能性があります。
-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.
編集:また、これ別の質問への回答。
答え3
ユーザーがロックされているようです。試してみてください
usermod -U user
また/etc/shadow
、ユーザーの行は次のように開始する必要があります。
user:$6$SALT...
ラインが
user:!!:..
user:*:...
アカウントはロックされます。