LoginSignup
97
91

More than 5 years have passed since last update.

パスワードなしでSSHログインする簡単な手順

Last updated at Posted at 2015-01-20

ログイン元サーバで秘密鍵と公開鍵の作成

# cd ~
# mkdir .ssh
# chmod 700 .ssh
# ssh-keygen -t dsa

これにより、id_dsa(秘密鍵)とid_dsa.pub(公開鍵)が作成される

公開鍵をログイン先サーバに転送

# scp id_dsa.pub 192.168.137.127:/home/user/
# ssh 192.168.137.127

公開鍵をログイン先サーバに登録

cd ~
mkdir .ssh
chmod 700 .ssh
cd .ssh
cat ~/id_dsa.pub >> authorized_keys
chmod 600 authorized_keys

公開鍵認証を許可する

sed -i -e "s/#PubkeyAuthentication/PubkeyAuthentication/g" /etc/ssh/sshd_config
PubkeyAuthentication yes

に変更する

sshデーモンの再起動

service sshd restart
97
91
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
97
91