SSH (Secured Shell)
Kothandaraman Kannadasan Lv3

Definition

SSH is stands for Secured Shell. It is a network protocol that is used to send the commands in a secure way to the host from the client.

On the SSH Server

For Debian-based system:

1
2
3
4
5
sudo apt update
sudo apt install openssh-server -y
sudo systemctl enable ssh
sudo systemctl start ssh
sudo systemctl status ssh

On the SSH Client

1
2
sudo apt update
sudo apt install openssh-client -y

Test SSH Connection from Client

1
ssh username@server_ip_address

Transferring the files over SCP (Secured Copy Protocol)

Copy file from local to remote.

1
2
scp /path/to/local/file username@remote_host:/path/to/remote/destination
# Ex: scp myfile.txt user@192.168.1.100:/home/user/

Copy file from remote to local.

1
2
scp username@remote_host:/path/to/remote/file /path/to/local/destination
# Ex: scp user@192.168.1.100:/home/user/myfile.txt ./

Transferring the files over rsync (Remote Sync)

Copy file from local to remote.

1
2
rsync -avz /path/to/local/file username@remote_host:/path/to/remote/destination
# Ex: rsync -avz myfile.txt user@192.168.1.100:/home/user/

Copy file from remote to local.

1
2
rsync -avz username@remote_host:/path/to/remote/file /path/to/local/destination
# Ex: rsync -avz user@192.168.1.100:/home/user/myfile.txt ./

Options Breakdown

  • -a: archive mode (preserves permissions, symbolic links, etc.)
  • -v: verbose
  • -z: compress file data during the transfer