現在のログインシェルの確認
変更前のログインシェルを確認するには以下のコマンドを実行します。
$ grep $USER /etc/passwd
sample:x:1000:1000:,,,:/home/sample:/bin/bash
上の場合にはログインシェルは/bin/bash
です。
変更方法
ログインシェルを変更するには次のコマンドを実行します。
chsh -s シェル
/bin/sh
をログインシェルにする場合には以下のようにします。
$ chsh -s "$(which sh)"
Password:
また利用できるシェルの一覧を確認するには次のコマンドを使用します。
$ cat /etc/shells
# /etc/shells: valid login shells
/bin/sh
/bin/bash
/bin/rbash
/bin/dash
sudo
を使用して以下のように実行しても同様の結果となります。
sudo chsh -s "$(which sh)" sample
$ grep $USER /etc/passwd
sample:x:1000:1000:,,,:/home/sample:/bin/sh