Ssh

From Wasya Wiki
Revision as of 19:12, 29 September 2024 by Piousbox (Talk | contribs) (Created page with "=== service === service ssh start === Establish a simple ssh port forward === 10.0.0.x is public, 10.0.1.x is private. Do: sudo sysctl net.ipv4.ip_forward=1 sudo iptab...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

service

 service ssh start

Establish a simple ssh port forward

10.0.0.x is public, 10.0.1.x is private. Do:

sudo sysctl net.ipv4.ip_forward=1
sudo iptables -t nat -A PREROUTING -p tcp -d 10.0.0.229 --dport 2270 -j DNAT --to-destination 10.0.1.224:22
sudo iptables -t nat -A POSTROUTING -j MASQUERADE

trash

Add ssh key to a server

cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'

Add identity to a server

ssh-copy-id -i ~.ssh/key_name.pub user@host