ssh forwarding - stereoboy/Study GitHub Wiki
Reference
- SSH Tunneling: Examples, Command, Server Config
- SSH Port forwarding
- SSH Port Forwarding μ΄ν΄νκΈ° (ν΄μ»€μ κ΄μ μμμ μ΄λ‘ )
- Create your own Virtual Private Network for SSH with Putty
- How to Remote Access IoT SSH over the Internet
-
- [SSH, Network] SSH ν¬νΈ ν¬μλ©(SSH ν°λλ§)μ κ°λ
λ° μ¬μ© λ°©λ²
- μλ²μμ μ격μμ€ν
μ κ·Ό
- SSH 리λ²μ€ ν°λλ§ μ μνκΈ°
- reverse-ssh-port-forwarding
- SSH tunnel as systemd service
Example
- Client Side (Target to connect)
wom@nesfr7-01:~$ ssh -R 8585:localhost:22 -i aws_us_west_1.pem [email protected]
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1033-aws x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
System information as of Tue May 2 08:42:36 UTC 2023
System load: 0.0 Processes: 101
Usage of /: 10.5% of 15.32GB Users logged in: 1
Memory usage: 9% IPv4 address for eth0: 172.31.13.19
Swap usage: 0%
* Introducing Expanded Security Maintenance for Applications.
Receive updates to over 25,000 software packages with your
Ubuntu Pro subscription. Free for personal use.
https://ubuntu.com/aws/pro
Expanded Security Maintenance for Applications is not enabled.
0 updates can be applied immediately.
Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status
The list of available updates is more than a week old.
To check for new updates run: sudo apt update
New release '22.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Tue May 2 08:33:37 2023 from 221.150.237.133
ubuntu@ip-172-31-13-19:~$
ubuntu@ip-172-31-13-19:~$ ssh wom@localhost -p 8585
wom@localhost's password:
Welcome to Ubuntu 20.04.4 LTS (GNU/Linux 5.10.104-tegra aarch64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This system has been minimized by removing packages and content that are
not required on a system that users do not log into.
To restore this content, you can run the 'unminimize' command.
* Introducing Expanded Security Maintenance for Applications.
Receive updates to over 25,000 software packages with your
Ubuntu Pro subscription. Free for personal use.
https://ubuntu.com/pro
314 updates can be applied immediately.
238 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable
Last login: Tue May 2 17:34:14 2023 from 192.168.0.13
wom@nesfr7-01:~$
Management from Server
$ sudo netstat -ap | grep 8587
tcp 0 0 localhost:8587 0.0.0.0:* LISTEN 1287/sshd: ubuntu
tcp6 0 0 ip6-localhost:8587 [::]:* LISTEN 1287/sshd: ubuntu
$ ps -aux | grep sshd
root 655 0.0 0.3 12184 7400 ? Ss Jun11 0:00 sshd: /usr/sbin/sshd -D -o AuthorizedKeysCommand /usr/share/ec2-instance-connect/eic_run_authorized_keys %u %f -o AuthorizedKeysCommandUser ec2-instance-connect [listener] 0 of 10-100 startups
root 840 0.0 0.4 13800 9020 ? Ss 00:01 0:00 sshd: ubuntu [priv]
ubuntu 942 0.0 0.3 13932 6236 ? S 00:01 0:00 sshd: ubuntu@pts/0
root 1214 0.0 0.4 13808 9032 ? Ss 00:45 0:00 sshd: ubuntu [priv]
ubuntu 1287 0.0 0.2 13940 5420 ? S 00:45 0:00 sshd: ubuntu <- ssh-forwarding process
ubuntu 1298 0.0 0.1 8168 2548 pts/1 S+ 00:48 0:00 grep --color=auto sshd
kill -9 1287