Ubuntu SSH

OpenSSH is a set of tools that allow users to remotely control their computers or transfer files between them in a secure and encrypted manner.

Open SSH Server Install on Ubuntu
sudo apt install openssh-server

sudo systemctl status ssh
sudo systemctl start ssh
sudo systemctl stop ssh
sudo systemctl restart ssh

Create the RSA/ed25519 key pair on your local desktop/laptop
ssh-keygen -m PEM -t rsa -b 4096 -C “Dan-RSA-V1”
C:\Users\User.ssh\id_rsa Private File
C:\Users\User.ssh\id_rsa.pub Public File
Icacls “User-D-SSH.pem” /Inheritance:r
Icacls “User-D-SSH.pem” /Grant:r win-username:”(R)”

Add Public key to Server
You add the contents of your id_rsa.pub file to the end of the authorized_keys file.

mkdir -p ~/.ssh
chmod 700 ~/.ssh Secure Folder
ls -a | grep .ssh
ls -d $PWD/* find .ssh
cd ~/.ssh
nano ~/.ssh/authorized_keys
Add the contents of your id_rsa.pub file to the end of the authorized_keys

Enable Password Authentication and SSH on the server
sudo nano /etc/ssh/sshd_config Add the following to sshd_config ————
PubkeyAuthentication yes
PasswordAuthentication yes

Login to SSH with this command
ssh azureuser@

Run SSH over the HTTPS
ssh -T -p 443 git@ssh.github.com

Validate RSA SSH public key file (id_rsa.pub)
ssh-keygen -l -f .ssh/id_rsa.pub

Copy files to the server using SSH
To copy file from Local Location to Remote Location (Upload)
scp c:\temp\cacak.jpg ubuntu@hostname:/tmp/beograd.jpg

To copy all folders from Remote Location to Local Location (Download)
scp -r ubuntu@hostname:/tmp c:/temp2

To copy all Folders from Local Location to Remote Location (Upload)
scp -r c:/temp3 ubuntu@hostname:/tmp

SSH Tunnel Forward to Secondary Remote host
ssh azureuser@ -Nf -p 22 -L -v
Remote RDP Host =
Remote RDP port 3389
Local Windows workstation IP=
Local Windows workstation Port=4001
RDP Connection=

watch ‘netstat -abn | grep 4001 Run on SSH

SSH Tunnel Forward to port SSH Host (port forward)
ssh azureuser@ -L 4001:
RDP Connection

-N: Only forward ports and do not execute commands.
-f: Put SSH in the background after the connection is established