notes icon indicating copy to clipboard operation
notes copied to clipboard

VSCode连接远程服务器

Open jawil opened this issue 5 years ago • 0 comments

本地密码登录远程服务器

ssh -p 29197 [email protected]

使用 ssh 免密码登录

  1. 本机操作:

ssh-keygen -t rsa -C "[email protected]"

  1. 远程服务器操作
mkdir .ssh
cd .ssh
touch authorized_keys
chmod 700 authorized_keys
cp id_rsa.pub authorized_keys
vim /etc/ssh/sshd_config

最后一步参考如下修改,如果前面有# 去除

StrictModes no  
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys      #ssh文件位置
PasswordAuthentication yes                        #使用密码  no为不使用密码
AuthenticationMethods publickey,password          #如果密码和密钥都使用在末尾加上此行代码

重启ssh服务

systemctl restart sshd.service

image

jawil avatar Nov 05 '19 08:11 jawil