SSH
SSH Key Generation
$ mkdir ~/.ssh
$ cd ~/.ssh
$ ssh-keygen -t rsa
Enter file: ubuntu@sinpro-dev
Enter passphrase: ********
ssh -i ~/.ssh/ubuntu@sinpro-dev ubuntu@153.127.***.***
Using the SSH Config File
Create a new SSH client configuration: ~/.ssh/config
Host sinpro-dev
HostName 153.127.***.***
Port ****
IdentityFile ~/.ssh/dev@sinpro-dev
User dev
You can connect with the following command:
ssh sinpro-dev
Port changing
Packet Filtering
Set up a packet filter so you can connect to the destination port.
Installing netstat on Ubuntu
# sudo apt update && sudo apt upgrade
# sudo apt install net-tools
Run the netstat
The SSH server on Ubuntu listen on TCP port 22 by default. You can run the netstat command to check ssh port currently running on:
# sudo netstat -tulnp | grep ssh
Configurations
Open the file:
# sudo micro /etc/ssh/sshd_config
Edit the file:
Port XXXX
Restart the SSH server
# sudo systemctl restart ssh
Confirm that the port has been changed
# sudo netstat -tulnp | grep ssh
VSCode configuration
Install Remote - SSH VSCode Extension.
This extension allows you to use VSCode by connecting via SSH.