ssh enables encrypted remote shell access between Linux machines. You can remotely log in to servers and manage systems securely.
ssh user@hostname
Example:
ssh [email protected]sudo apt install openssh-server
sudo systemctl enable --now sshssh -p 2222 user@host
ssh -i ~/.ssh/id_rsa user@host
ssh -L 8080:localhost:80 user@host
scp copies files securely between hosts over SSH. It encrypts both credentials and file data during transfer.
scp file.txt [email protected]:/home/user/scp [email protected]:/home/user/file.txt ./scp -r myfolder/ user@host:/home/user/| Option | Purpose | Example |
|---|---|---|
| -P | Custom SSH port | |
| -i | Private key authentication | |
| -r | Recursive folder copy | |
| -v | Verbose output for debugging | |
ssh-keygen)~/.ssh/authorized_keys on remote hostchmod 600 ~/.ssh/id_rsafail2ban to prevent brute-force SSH attacksssh and scp are foundational tools for remote management and secure file transfers in Linux. Mastering them enables efficient and encrypted access between systems, strengthening both productivity and data security.