-
-
Notifications
You must be signed in to change notification settings - Fork 1
Arch Linux SSH Configuration
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to SSH configuration on Arch Linux, including server setup, client configuration, key-based authentication, and security hardening.
- Installing SSH
- SSH Server Configuration
- SSH Client Configuration
- Key-Based Authentication
- SSH Security
- Troubleshooting
Install SSH:
# Install OpenSSH
sudo pacman -S openssh
# Enable service
sudo systemctl enable sshd
sudo systemctl start sshd
# Check status
systemctl status sshdEdit config:
# Edit SSH config
sudo vim /etc/ssh/sshd_configSecurity settings:
# Disable root login
PermitRootLogin no
# Change port
Port 2222
# Disable password auth (use keys)
PasswordAuthentication no
# Allow specific users
AllowUsers username
# Disable empty passwords
PermitEmptyPasswords no
Restart SSH:
sudo systemctl restart sshdEdit client config:
# Edit client config
vim ~/.ssh/configExample:
Host myserver
HostName server.example.com
User username
Port 2222
IdentityFile ~/.ssh/id_ed25519
Connect:
ssh myserverCreate key pair:
# Generate key
ssh-keygen -t ed25519 -C "your_email@example.com"
# Or RSA
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"Copy to server:
# Copy key
ssh-copy-id user@server
# Or manually
cat ~/.ssh/id_ed25519.pub | ssh user@server "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"Security best practices:
# Edit config
sudo vim /etc/ssh/sshd_configAdd:
# Disable root
PermitRootLogin no
# Change port
Port 2222
# Use keys only
PasswordAuthentication no
PubkeyAuthentication yes
# Limit login attempts
MaxAuthTries 3
# Disable empty passwords
PermitEmptyPasswords no
Install fail2ban:
# Install fail2ban
sudo pacman -S fail2ban
# Enable
sudo systemctl enable fail2ban
sudo systemctl start fail2banCheck service:
# Check SSH service
systemctl status sshd
# Check firewall
sudo ufw statusCheck permissions:
# Fix permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keysThis guide covered SSH installation, server/client configuration, key-based auth, and security.
- Arch Linux Security Configuration - Security setup
- Arch Linux Networking - Network setup
- ArchWiki SSH: https://wiki.archlinux.org/title/OpenSSH
This guide is based on the ArchWiki. For the most up-to-date information, always refer to the official ArchWiki.