SSH Guide Thailand
Contents
What is SSH
SSH (Secure Shell) is a protocol for securely connecting to and controlling servers remotely via command line. It encrypts all traffic — unlike Telnet which sends data in plain text. SSH is the default access method for VPS and Linux cloud servers.
SSH
Command: ssh username@hostname or ssh username@IP — port 22 by default. If port changed, use -p: ssh -p 2222 user@server. First connection asks for fingerprint confirmation — type yes to trust.
SSH Windows
Windows 10/11 has a built-in SSH client. Open Command Prompt or PowerShell and type ssh user@server. Or use PuTTY (free) for GUI that easily saves sessions. Windows Terminal + OpenSSH Client recommended for developers.
SSH Mac Linux
Mac and Linux have SSH client pre-installed. Open Terminal and type ssh user@server directly. Mac Terminal, iTerm2, or Linux Gnome Terminal all support SSH without any additional installation.
SSH Linux
Once connected, use Linux commands: ls (list files), cd (change directory), mkdir (create folder), rm (delete), cp (copy), mv (move), cat (read file), nano/vim (edit file), chmod (change permission), chown (change owner).
SSH Key Authentication
SSH Key is more secure than passwords because no password is transmitted over the network. Create key: ssh-keygen -t ed25519 gives ~/.ssh/id_ed25519 (private key) and ~/.ssh/id_ed25519.pub (public key). Copy public key to server: ssh-copy-id user@server.
Security: SSH
Disable root login: PermitRootLogin no in /etc/ssh/sshd_config. Use a separate user with sudo instead. Use SSH Key instead of password. Disable password authentication: PasswordAuthentication no if using keys. Install Fail2Ban to block IPs with repeated failed logins.
Port SSH
Default port 22 is frequently scanned by bots. Changing to another port (e.g., 2222) reduces log noise. Edit /etc/ssh/sshd_config, change Port 22 to new port. Must restart sshd and open new port in firewall before closing current session.
SCP SFTP SSH
SCP (Secure Copy) transfers files via SSH: scp file.txt user@server:/path/ SFTP is FTP over SSH: sftp user@server. FileZilla supports SFTP protocol — more secure than regular FTP. rsync syncs only changed files in a directory.