所有远程ssh 必须加上下面的命令才能正常
# /etc/ssh/sshd_config 文件
GatewayPorts yes
# 重启ssh
/sbin/service sshd restart
密码登录
ssh <username>@<ip>
正常情况下是需要输入密码的,但是我已经实现了免密登录。
现在本地.ssh目录下生成key,一直按回车就可以自动生成了。
cd ~/.ssh # 渠道.ssh目录
ssh-keygen -t rsa # 生成key
上传你的key到阿里云服务器上面
scp id_rsa.pub root@119.29.21.17:~/.ssh/id_rsa.pub # 上传到vpn的~/.ssh/id_rsa.pub 目录中
登录vpn,修改上传的文件名字为authorized_keys
cat id_rsa.pub >> authorized_keys
logout # 退出登录
一键开启nodejs服务器在5500端口
URL打开 http://localhost:8889/
无法访问,运行一下命令
ssh -gL 8889:127.0.0.1:5500 localhost
再次刷新页面,可以了,...
顾名思义,本地端口转发,将所有8889端口所有http请求转发到5500端口,关闭5500端口服务,再次刷新8889端口页面,已然无法访问
ssh -D 1088 root@65.49.223.188 # 动态转发本地所有1088端口 22登录 ,居然可以走代理了,,...
ssh -D 8987 root@65.49.223.188 # 动态转发vpn开的居然不行....
ssh -fNR 8888:localhost:80 root@119.29.21.17
-f 后台运行 -C 允许压缩数据 -N 不执行任何命令 -R 将端口绑定到远程服务器,反向代理 -L 将端口绑定到本地客户端,正向代理
nmap 192.168.0.0-255 // 扫描局域网内全网段
Starting Nmap 7.70 ( https://nmap.org ) at 2018-12-22 23:16 CST
Nmap scan report for 192.168.0.1 // 路由器的端口
Host is up (0.0093s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
80/tcp open http
1900/tcp open upnp
Nmap scan report for 192.168.0.100 // 未知端口
Host is up (0.0100s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
23/tcp open telnet
80/tcp open http
8000/tcp open http-alt
Nmap scan report for 192.168.0.101 // 我手机连接wifi后的端口
Host is up (0.0095s latency).
Not shown: 997 closed ports
PORT STATE SERVICE
3000/tcp open ppp
3001/tcp open nessus
5555/tcp open freeciv
Nmap scan report for 192.168.0.102 // 我的mac连接电脑后的端口
Host is up (0.00030s latency).
Not shown: 979 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
88/tcp open kerberos-sec
99/tcp filtered metagram
366/tcp filtered odmr
543/tcp filtered klogin
1031/tcp filtered iad2
1062/tcp filtered veracity
1105/tcp filtered ftranhc
1199/tcp filtered dmidi
2251/tcp filtered dif-port
3283/tcp open netassistant
3306/tcp open mysql
3920/tcp filtered exasoftport1
4002/tcp filtered mlchat-proxy
5900/tcp open vnc
8083/tcp filtered us-srv
9110/tcp filtered unknown
44176/tcp filtered unknown
49152/tcp filtered unknown
52848/tcp filtered unknown
Nmap scan report for 192.168.0.156 // 未知端口
Host is up (0.0067s latency).
Not shown: 998 closed ports
PORT STATE SERVICE
23/tcp open telnet
8000/tcp open http-alt
Nmap scan report for 192.168.0.165 // 未知端口
Host is up (0.011s latency).
Not shown: 999 closed ports
PORT STATE SERVICE
7800/tcp open asr
Nmap done: 256 IP addresses (6 hosts up) scanned in 33.40 seconds
30几秒搞定