cd /root/.ssh
上传id_rsa.pub 到 /root/.ssh
授权密钥:
chmod 600 /root/.ssh/authorized_keys
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
安装启动防火墙:
yum -y install firewalld
systemctl start firewalld
systemctl enable firewalld
#修改ssh配置:修改默认ssh端口、开启秘钥登录、、禁止密码登录、开启闲置超时
sed -i “s/^#Port./Port 1557/g" /etc/ssh/sshd_config
sed -i "s/^#RSAAuthentication./RSAAuthentication yes/g” /etc/ssh/sshd_config
sed -i “s/^#PubkeyAuthentication./PubkeyAuthentication yes/g" /etc/ssh/sshd_config
sed -i "s/^PasswordAuthentication./PasswordAuthentication no/g” /etc/ssh/sshd_config
重启ssh服务:
systemctl restart sshd
显示所有公共端口:
firewall-cmd --zone=public --list-ports
开放端口:
firewall-cmd --permanent --add-port=1557/tcp
firewall-cmd --permanent --add-port=25/tcp
firewall-cmd --permanent --add-port=80/tcp
查询本机当前开放端口:
netstat -ntpl
5、sz和rz 命令安装口
执行:yum install lrzsz
等待安装完毕,然后一直输入Y即可
linux默认版本是无法使用 sz和rz 命令的,会提示:waiting to receive.**B0100000023be50
这个时候,换个工具连接Linux即可(如Xshell)