linux ssh 转发端口及使用

mac2022-06-30  170

1、设置rsa登陆

ssh-keygen -t rsa -p

3次回车,出现下面的信息,表示rsa生成的位置

Enter file in which the key is (/home/ubuntu/.ssh/id_rsa): Enter new passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved with the new passphrase.

将生成的id_rsa.pub拷贝至目标服务器

scp .ssh/id_rsa.pub root@targetHost:/root/.ssh/id_rsa.pub

id_rsa.pub添加至authorized_keys中,同时,设置authorized_keys的访问权限

cat id_rsa.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys

免密ssh登陆完成

2、使用ssh隧道,转发7070端口

ssh -qTfnN -D 7070 root@host

3、浏览器设置代理服务器信息

(对应的应用也可以设置相应的应用的代理)

设置>代理服务器>SOCKS>填写127.0.0.1,端口7070

转载于:https://www.cnblogs.com/HeJD/p/8702019.html

最新回复(0)