1
1

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.

【Rocky Linux 9】02.SSH設定

Posted at

SSHの設定

  • 「root」でログインさせない
  • 空のパスワードでログインさせない
  • パスワードではなく鍵認証とする
/etc/ssh/sshd_config
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthenticatio no
PermitEmptyPasswords no

SSH再起動

再起動させると同時に、自動起動としておく。

systemctl stop sshd.service
systemctl enable --now sshd.service

鍵認証設定

一般ユーザーで行う

鍵認証用の鍵ペア作成

色々と問われるが、全て「空Enter」とする

ssh-keygen -t ed25519 -a 256

・パスフレーズを設定する場合

ssh-keygen -t ed25519 -a 256 -N "パスフレーズ"

・GitHubで使用する書きを作成する場合

ssh-keygen -t ed25519 -a 256 -C user@example.com

公開鍵設定

cd
cat .ssh/id_ed25519.pub > authorized_keys
chmod 600 .ssh/authorized_keys
rm -f .ssh/id_ed25519.pub

秘密鍵設定

秘密鍵は、一般ユーザーのホームディレクトリに移動した後の.ssh/id_ed25519となる。
重要なファイルであるため、SCP等で移動させ、ローカルに保存しておく。
この秘密鍵を利用し、サーバーへと公開鍵接続を行う
Windowsの場合、
https://kmiya-culti.github.io/RLogin/
https://www.ranvis.com/putty
https://poderosa.sourceforge.net/index-ja.html
このあたりのSSHクライアントがオススメです。

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?