Vscode remove-ssh遠(yuǎn)程開發(fā)很方便,但是每次登陸都會(huì)頻繁要求輸入密碼,使用期間也會(huì)多次斷開重連,提示再次輸入密碼。
可能因?yàn)槲议_發(fā)板的ubuntu系統(tǒng)用的后來創(chuàng)建的用戶的原因,按網(wǎng)上的文章始終無法實(shí)現(xiàn)免密登錄,多次嘗試后如下方式解決,整理如下:
1. 本地生成key
ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa-remote-ssh
生成的文件在/Users/xxx/.ssh下
2. 創(chuàng)建目錄
mkdir /home/用戶名/.ssh/
3. 上傳key到用戶名錄的.ssh下,文件名必須為authorized_keys
scp /Users/xxx/.ssh/id_rsa-remote-ssh.pub arslantech@192.168.43.141:/home/用戶名/.ssh/authorized_keys
4. linux中權(quán)限設(shè)置
cd /home/用戶名/.ssh
sudo chmod 600 authorized_keys
sudo chmod 700 ~/.ssh
5. 開啟配置/etc/ssh/sshd_config中
RSAAuthentication yes
PubkeyAuthentication yes
PasswordAuthentication no
6. 重啟服務(wù)
service sshd restart
如果有多個(gè)用戶可能會(huì)提示你選擇用戶,選擇之前放置authorized_keys的用戶
7. Vscode remote-ssh中設(shè)置
/Users/用戶/.ssh/config mac下配置文件在這里文章來源:http://www.zghlxwxcb.cn/news/detail-810250.html
Host 192.168.43.141
HostName 192.168.43.141
User 用戶名
IdentityFile "~/.ssh/id_rsa-remote-ssh"
用戶名自行修改,IdentityFile對(duì)應(yīng)私鑰文件文章來源地址http://www.zghlxwxcb.cn/news/detail-810250.html
8. 重啟Vscode測(cè)試免密登錄
到了這里,關(guān)于樹莓派ubuntu:vscode remote-ssh免密登錄(Mac)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!