ssh 远程管理 远程拷贝

安装软件: openssh-server 提供服务 openssh-clients 客户端 openssh

#yum install openssh*  -y

ssh 端口22 服务器端: 启动服务: #systemctl start sshd

查看:
  lsof -i:22

关闭防火墙和selinux

客户端: 远程登陆管理: # ssh -X tom@10.18.44.208 -p 2222
ssh 10.18.44.208 如登陆果账户没有密码,默认不能

无密码登陆(ssh密钥认证) client: 产生公钥和私钥: #ssh-keygen //一路回车
拷贝公钥给对方: #ssh-copy-id -i 10.18.44.208

直接执行远程命令: #ssh 10.18.44.208 "reboot"

远程拷贝: 需要先安装客户端 #cp 源文件 目标路径

 谁是远程谁加IP
#scp    /a.txt     192.168.2.108:/
#scp   192.168.2.108:/a.txt     ./      
 -P端口
 拷贝目录加-r选项
 
 #scp   192.168.2.108:/a.txt     192.168.2.109:/ 

修改端口号 vim /etc/ssh/sshd_config

Port 22   
ListenAddress 192.168.2.8
PermitRootLogin yes
MaxSessions 10        最大并发量
PermitEmptyPasswords no