使用ssh key取代密码登陆服务器

生成Key

$ ssh-keygen -t rsa -b 4096 -C “your_email@domain.com”

$ cd ~/.ssh && ls -l ~/.ssh/id_*.pub

传送key到server

$ ssh-copy-id root@server_ip_address

取消密码登陆

$ ssh root@server_ip_address

$ vim /etc/ssh/sshd_config

找到下面并改成这样

PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no

$ systemctl restart ssh

以后直接ssh root@server_ip_address 输入密码就可以登陆服务器了,注意:密码别忘了,key要备份。

    发表回复

    手机应用APP浏览更方便

    手机APP可以快速且方便的浏览,
    并且可以使用多种支付方法。