11 远程连接服务器 ssh xdmcp vnc xrdp
11-1 远程连接服务器
11-2 文字接口连接服务器:ssh服务器
11-2-2 启动ssh服务器
google centos 7 netstat
http://www.centoscn.com/CentOS/config/2014/0905/3681.html
yum install net-tools
google centos 7 etc init.d sshd
http://www.putorius.net/2014/07/restarting-services-in-red-hat-7-or.html
systemctl restart sshd.service
#google centos 7 etc init.d sshd
systemctl restart sshd.service
netstat -tlnp
ssh -p22 root@127.0.0.1
exit
11-2-3 ssh客户端连接程序——linux用户
google ssh mkdir
http://unix.stackexchange.com/questions/8612/programmatically-creating-a-remote-directory-using-ssh
ssh remote-host-ip ‘. ~/your_profile; mkdir your_directory’
google cli socks5
http://askubuntu.com/questions/610333/how-to-set-socks5-proxy-in-the-terminal
sudo proxychains4 apt-get update
ssh:直接登录远程主机的指令:
rm ~/find.log
ssh -p22 root@127.0.0.1 find / &> ~/find.log #没有-f会等待指令完毕
ls ~ #需要分开执行,因为没有-f选项
rm ~/find.log
ssh -p22 root@127.0.0.1 -f 'find /' &> ~/find.log #返回log到客户端而不是服务器
ls ~
sum: find /
在服务器执行,重定向到本地服务器。这个演示server和client的交互
完全在服务器执行需要加上引号,ssh -p22 root@127.0.0.1 'find / &> ~/find.log ; ls ~'
服务器公钥记录文件:
cat ~/.ssh/known_hosts
sftp:
cd ~
touch ./client.txt
sftp -P22 root