LoginSignup
1
0

More than 5 years have passed since last update.

SSHでセキュリティよくする。

Last updated at Posted at 2017-10-30

sshでrsa認証する

rootユーザでログインしてると、とてもまずいので別のユーザーを作成します。

userのところは変えてください。

bash
adduser user
usermod -G sudo user
su user
mkdir ~/.ssh

MACで鍵を作成する。

bash
mkdir ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa

公開鍵を送信する。

bash
scp id_rsa.pub user@123:45:67:89:/home/user/.ssh

SSHのポートを変更すると相手から、接続しづらくなります。

bash
sudo nano /etc/ssh/sshd_config
/etc/ssh/sshd_config
port 10022       #好きな番号で

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      %h/.ssh/id_rsa.pub

PasswordAuthentication no
1
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
1
0