SSH
Install ssh daemon
pacman -Syu openssh
systemctl enable sshd.service
Keypair
ssh-keygen -t ed25519 -C "comment"
ssh-copy-id -i ~/.ssh/key.pub -p port usr@ip
On remote - sshd_config
disable pwd login
EDIT /etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no
PubkeyAuthentication yes
Connect to server
ssh -i /path/to/key -p port usr@ip
ssh hostname -t "tmux new -As ssh" # -t open tty
## this will set env
ssh hostname -t "exec env LANG=en_US.utf8 tmux new -A"
## for tmux, -u can be used
ssh hostname -t "tmux -u new -A"
SSH tunnel
# connect SSH through port - localport and remoteport refer to machine behind router
# -L can be used multiple times to tunnel multiple ports at the same time
ssh -i /path/to/key -p port -L localport:localhost:remoteport usr@ip
config file
# chmod to 600
# Other options see /etc/ssh/ssh_config
EDIT .ssh/config
HOST hostname
HostName 8.8.8.8
User user
Port 22001
IdentityFile ~/.ssh/id_ed25519
LocalForward 5901 localhost:5901
Compression yes
LogLevel INFO
RemoteCommand tmux -u new -A
RequestTTY yes
ssh hostname
ssh -o "User=anotherUser" hostname
ssh -F /path/to/alt/config hostname
ssh -F /dev/null user@ssh-example.com # ignore config file
sftp
sftp -oPort=number usr@host
sftp -P port -i /path/to/key name@host
> help
> ls
> lls
> put filename