ssh命令


Are you sure you want to continue connecting

ssh -o StrictHostKeyChecking=no root@localhost
ssh -o GSSAPIAuthentication=no root@localhost

/etc/ssh/ssh_config

StrictHostKeyChecking no
GSSAPIAuthentication no

SSH免密码登录

// 安装vim
yum install vim -y

vim /etc/ssh/sshd_config

#Port 22
PermitRootLogin yes
// centos8修改密码
yum install -y passwd
passwd root [root]
// 安装ssh工具
yum install -y openssl openssh-server openssh-clients.x86_64
systemctl status sshd
systemctl restart sshd
// 生成密钥
ssh-keygen -t rsa -C "centos8"
// 将本地公钥上传到服务器的用户目录
scp -P 1022 ~/.ssh/id_rsa.pub root@localhost:~ 
// 将本地公钥添加到服务器已认证密钥中
cat ~/id_rsa.pub >> .ssh/authorized_keys