1. ssh debug
# ssh -vvv username@host
  1. 运行远程命令
# ssh username@host 'cat /etc/issue'
Ubuntu 19.04 \n \l
# ssh -t root@66.42.56.193 'top' #交互式shell
  1. ssh隧道
# ssh -C -N -f -L 127.0.0.1:7001:127.0.0.1:3128 username@host
  1. 远程拷贝文件
# scp [user@]host:[path] . #从服务上下载
# scp filename [user@]host:[path] # 上传文件到服务器
  1. 生成新的公私密钥对
    # ssh-keygen
    
  2. ubuntu18.04 ssh自定义登录提示信息
# vi /etc/motd
  1. SOCKS server, 端口号为8888,可以替换成其他端口
    # ssh -N -D 127.0.0.1:8888 root@your_vps_host
    

参考资料

https://www.ibm.com/developerworks/cn/linux/l-cn-sshforward/ https://wiki.ubuntu.com/UpdateMotd#Design