Related
Secure Copy Files Between Hosts
Securely copy files or directories between local and remote hosts over SSH.
Test Network Connectivity
Test the reachability of a network host and measure round-trip time for packets sent to it.
Configure Network Interfaces
Display or configure network interface parameters.
Command
sshExplanation
The `ssh` (Secure Shell) command establishes encrypted network connections to remote systems. It authenticates users with passwords or cryptographic keys and allows command execution or full terminal sessions. It also supports tunneling, forwarding, and agent-based authentication.
Common Use Cases
- •Remote server administration
- •Running commands on remote machines
- •Secure file transfers using `scp` or `sftp`
Best Practices
- ✓Use SSH key-based authentication instead of passwords
- ✓Disable root login in `/etc/ssh/sshd_config`
- ✓Regularly rotate SSH keys for security
Common Mistakes to Avoid
- ⚠Incorrect file permissions on private keys
- ⚠Forgetting to specify custom SSH ports
Troubleshooting
Problem: Permission denied (publickey)
Solution: Ensure the correct private key is used and permissions are set to 600.
Problem: Connection refused
Solution: Verify SSH service is running and firewall rules allow connections.
Examples
Connect to remote host as specified user
ssh user@hostConnect on a custom SSH port
ssh -p 2222 user@hostAuthenticate with specific private key
ssh -i ~/.ssh/id_rsa user@host