VPS允许root免密登录

配置vps

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 将本地主机的ssh公钥粘贴在
/root/.ssh/authorized_keys
# 如上图所示

sudo -i 
vi /etc/ssh/sshd_config
修改
# Authentication:
PermitRootLogin yes //默认为no,需要开启root用户访问改为yes
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication yes //默认为no,改为yes开启密码登陆

passwd root
/etc/init.d/ssh restart

本地新建config

~/.ssh.config

1
2
3
4
5
host ecs
   user root
   hostname 47.117.128.212
   port 22
   identityfile ~/.ssh/id_rsa

这样本地主机就可以不用输入ip和密码直接用ssh ecs登录vps

---------------- ♥ The End ♥ ----------------
意思意思?
0%