About
This is a guide for setting up SSH on Unix systems. This guide assumes that the SSH server is running on a Unix system and the client is also a Unix system.
Server Setup
-
Install SSH server
# Arch sudo pacman -S openssh # Ubuntu sudo apt install openssh-server
-
Start SSH server
sudo systemctl start sshd sudo systemctl enable sshd
-
Configure SSH server
sudo vim /etc/ssh/sshd_config
# Disable password authentication PasswordAuthentication no # Disable root login PermitRootLogin no # Only allow specific users AllowUsers <username>
Client Setup
-
Generate SSH key
ssh-keygen -t ed25519 -C "[email protected]"
-
Copy SSH key to server
ssh-copy-id -i ~/.ssh/id_ed25519.pub <username>@<server_ip>
-
Configure SSH client
vim ~/.ssh/config
Host <alias> HostName <server_ip> User <username> IdentityFile ~/.ssh/id_ed25519