ユーザー(useradd -d /home/newuser -c "My new user" -s /bin/true newuser
)を作成し、パスワード(su newuser
)を設定し、このユーザー名で作業したかったです。ただし、そのユーザーに切り替えることはできません。エラーメッセージなし、警告なし - 移行が成功しませんでした。
olduser@mymachine$ su - newuser
Password:
olduser@mymachine$ whoami
olduser@mymachine$ olduser
または
olduser@mymachine$ su newuser
Password:
olduser@mymachine$ whoami
olduser@mymachine$ olduser
SUSE Linux Enterprise Server 12でCLIを介してユーザーを切り替えるには?
ベストアンサー1
newuser
割り当てるシェルを指定して作成した方法だと思います。/bin/true
-s /bin/true
useradd
マニュアルページから:
https://linux.die.net/man/8/useradd
-s, --shell SHELL
The name of the user's login shell. The default is to leave this field blank, which causes the system to select the default login shell specified by the SHELL variable in /etc/default/useradd, or an empty string by default.
/bin/true
終了ステータスに設定すると、0
エラーメッセージは生成されません。これらのシェル設定は、システムにログインすることが許可されていないユーザーにのみ一般的です。通常/bin/false
、この結果はcannot create shell
少なくとも失敗の理由を提供するのと同様のエラーメッセージを生成するために使用されます。
で解決可能ですusermod -s /bin/bash newuser
。