What Is the ssh Command in Linux?¶
Introduction¶
The ssh command opens secure remote shell sessions and runs remote commands. It is useful for beginners, Linux administrators, DevOps engineers, and RHCSA students because it solves practical terminal tasks.
What the Command Does¶
Use ssh to work with the specific Linux object it manages. Before changing anything, identify the target and run a read-only check when possible.
Basic Syntax¶
ssh USER@HOST
The syntax includes the command, any options, and the target object.
Common Options¶
-p: connect to a custom port.-i: use an identity file.-v: show debug output.
Practical Examples¶
ssh admin@server.example.com
ssh admin@server.example.com hostname
ssh -p 2222 admin@server.example.com
ssh -i ~/.ssh/id_rsa admin@server.example.com
Verification command:
ssh -V
Example output:
OpenSSH_9.6p1, OpenSSL 3.0.7 1 Nov 2022
When to Use This Command¶
Use ssh to administer remote Linux systems, run one-off remote commands, or create secure tunnels. It is the standard remote access tool for servers.
Common Mistakes¶
- Using the wrong remote username.
- Leaving private key permissions too open.
- Troubleshooting authentication without trying
ssh -vfor useful details.
Quick Reference¶
ssh admin@server.example.com
ssh admin@server.example.com hostname
ssh -V
Related Guides¶
Summary¶
The ssh command is safest when you understand the target, choose the right option, and verify the result with a separate command.