REMOTE DEVICE
commands for ubuntu
prerequisites:
openssh-server, ufw ubuntu ship with ufw
NOTE: if on vps without dedicated ipV4, enable IPV6 for ufw set IPV6=yes in /etc/default/ufw
enable services
check service status and ensure both are enabled
allow ssh on remote device:
this means ssh port must be opened
HOST DEVICE
ssh into remote machine from host without password
Danger zone
share private key for remoteDevice_ed25519 with other devices NOTE: this also be done with copy pasting when sshed into Host from trsuted device or using flash drive.
Configs
when there are multiple devices it is easier to keep track of them in configs config file: ~/.ssh/config
ex:
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github_id_rsa
IdentitiesOnly yes
# Gitlab account
Host gitlab.com
HostName gitlab.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitlab_ed25519
IdentitiesOnly yes
# gaming laptop
Host lenovo
HostName 192.168.86.52
User wbe
IdentityFile ~/.ssh/lenovo_ed25519
IdentitiesOnly yes
# thinkpad
Host tp
HostName 192.168.86.36
User wbe
IdentityFile ~/.ssh/tp_ed25519
IdentitiesOnly yes
tips: in case host was added by mistake, remove with ssh-keygen -f $HOME/.ssh/known_hosts -R “[ip]:port”