LoginSignup
15
14

More than 5 years have passed since last update.

公開鍵なし/パスワードなしでSSHログインする設定

Posted at

普通に危険なので、どうしても公開鍵を使いたくない && 閉じたネットワーク 以外では絶対にやるべきではない。

検証環境: Ubuntu 14.04

sshdの設定

PermitEmptyPasswordsyesに、UsePAMnoに指定する。変更後、sshdを再起動する。

$ vi /etc/ssh/sshd_config
...
PermitEmptyPasswords yes
...
UsePAM no

$ sudo service ssh restart

パスワードなしユーザの作成

作成時点ではSSHログインする際にパスワードを要求される。passwd -d <ユーザ名>としてパスワードを空にしてしまえば、パスワードなしでログインできる。

$ sudo useradd -m hoge
$ ssh hoge@localhost
hoge@localhost's password:

$ sudo passwd -d hoge
passwd: password expiry information changed.
$ ssh hoge@localhost
$ pwd
/home/hoge
15
14
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
15
14