SSH
Linux
Guides
SSH-101:All about SSH
March 15, 2025
SSH
It stands for Secure Shell It is a network protocol that lets you access remote shells and manage remote machines. The data sent and received is encrypted and so it is safe. It uses encryption like RSA by default for its keys.
Installation:
To install ssh in remote machine
- For Ubuntu/Deb
sudo apt update
sudo apt install openssh-server
sudo service ssh start
- To check if service started
sudo service ssh status
Basic Commands:
Connect to a Remote Server:
ssh username@remote_host
Connect with a Specific Port:
ssh -p port_number username@remote_host
Copy Files from Local to Remote:
scp local_file username@remote_host:/path/to/destination
Copy Files from Remote to Local:
scp username@remote_host:/path/to/file local_destination
Execute a Command on Remote Server:
ssh username@remote_host 'command'
Port Forwarding (Local to Remote):
ssh -L local_port:destination_host:destination_port username@remote_host
Port Forwarding (Remote to Local):
ssh -R remote_port:destination_host:destination_port username@remote_host