LoginSignup
0
0

【Linux】Non-Pass設定

Last updated at Posted at 2023-10-22

やりたいこと

Batchサーバ(SSH接続元)からWebサーバ(SSH接続先)へのノンパス設定を行いたいです

SSH接続元に鍵を作成

Batchサーバ(SSH接続元)で鍵を作成します。

ls -al ~/.ssh

鍵が既にあるかの確認。
id_rsaとかid_rsa.pubがあったら、その中身を使い回せばOK。

ssh-keygen -t rsa

なかった場合は鍵を新しく作る
パスフレーズの入力を求められるが、何も入力せずEnterキーを押せば良い。

~/.ssh/id_rsa.pub
ssh-rsa AAAA............BBBB user@hostname

みたいな鍵が作られる。

作った鍵をSSH接続先に置く

SSH接続元で作った鍵をSSH接続先の~/.ssh/authorized_keysに追加。

~/.ssh/authorized_keys
ssh-rsa [KEY]

.sshがまだ有効になっていない場合は/etc/ssh/sshd_config編集して有効にする。

権限の設定

ファイルの所有者のみ読み書きできるよう設定する。

chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

以上

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