One way (suboptimal): Use Network Connections
(app tray on client)
Ethernet > Wired connection 1 > IPv4 Settings > Method: Manual > Addresses: Add > set below values > Save > systemctl reboot -i
- IP: 192.168.X.X
- Netmask: 255.255.255.0
- Gateway: your-router-dns-ip (Advanced Setup > WAN IP Addressing > Select the DNS type. > Static DNS Addresses > Primary DNS)
Better way: Use DHCP Reservation in Your Router
Advanced Setup > IP Address > DHCP Reservation > Manually Add MAC Address (your MAC address, taken from ifconfig
ether
field) > Manually Add IP Address (your desired static IP address)
Set up custom ssh port
https://askubuntu.com/questions/264046/how-to-ssh-on-a-port-other-than-22
!!!! BE CAREFUL TO EDIT sshd_config
and NOT ssh_config
!!!!
|
|
Locate # Port 22
Remove # and change to desired
|
|
Set up your static routing in router
in browser: 192.168.yourrouter.ip
- Destination IP: your static ip set above
- Subnetmask: 255.255.255.0
- Gateway IP: DNS gateway of your modem
- Wan Interface: atm0 and ptm0 work, ewan0 does not
Set up port forwarding in router
firewall > port forwarding
- ip address: static ip set above
- starting/ending port: port set in ssh above
- protocol: tcp, safer with packets than udp
Try to connect from the client
|
|
You may still get prompted for password
(note: you can enable/disable passwordless mode in /etc/ssh/sshd_config, look for PasswordAuthentication)
Copy ssh key from the client to the server
https://www.ssh.com/ssh/copy-id
ssh-copy-id -i ~/.ssh/mykey user@host -p customport
the -f will overwrite the key if it already exists
Set up the client config
vim ~/.ssh/config
|
|
Log in to the remote host
|
|
Problems? Watch the auth log on the server
|
|