0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Linux】ログインシェルの変更方法

Posted at

現在のログインシェルの確認

変更前のログインシェルを確認するには以下のコマンドを実行します。

$ 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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?