Difference between revisions of "Ssh"

From Wasya Wiki
Jump to: navigation, search
(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...")
 
(No difference)

Latest revision as of 19:12, 29 September 2024

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