0

Allow SSH access to your Linux Machine from anywhere

In this post, I will discuss you on how to install SSH service in Ubuntu Server and allow access from it anywhere. It means if you are away from your machine you can remote access on it as long as it is connected to the internet even without a public IP Address or was behind in NAT.

First, make sure you have installed SSH Service and allow it from the OS Firewall, if not follow the following steps:

To Install the SSH Service in Linux Machine, we need to execute the following commands:

For Ubuntu/Debian/Raspbian:

sudo apt-get install openssh-server

For CentOS/Rhel:

sudo yum install openssh-server

For Fedora:

sudo dnf install openssh-server

Allow SSH from Firewall and start the service:

For Ubuntu/Debian/Raspbian using UFW :

sudo ufw allow 'OpenSSH'

sudo service ssh restart

For CentOS/Rhel/Fedora using FirewallD:

sudo firewall-cmd --permanent --add-service=ssh

sudo firewall-cmd --reload

sudo service sshd start

Make sure your firewall was running, by invoking the following commands:

For Ubuntu/Debian/Raspbian using UFW :

service ufw status

For CentOS/Rhel/Fedora using FirewallD:

sudo systemctl firewalld status

If firewall is not running, then execute the following command to allow it to start from boot and start the firewall:

For Ubuntu/Debian/Raspbian using UFW :

sudo ufw enable

sudo service ufw start

For CentOS/Rhel/Fedora using FirewallD:

sudo systemctl start firewalld

sudo systemctl enable firewalld

Once SSH Service was installed and running then follow the instructions below:

Remote.it is an application that will be installed in our Linux Machine, this will portforward our SSH Service and other services to remote.it servers. remote.it will provide the connection details everytime we need to access the service such as SSH. The connection details will expire every 3-6 hours, so we need to generate another connection details from remote.it website, I think they made this process to avoid attackers from trying to access your ports for long time, or avoiding having static ports that is not being utilized by users. It means this is a service on-demand. 

To register from remote.it you need to sign up using your email, no payment or credit card required for personal Use. Click here for registration: remote.it

Once registered and account was verified.  Execute the following command to your Linux machine:

curl -LkO https://raw.githubusercontent.com/
remoteit/installer/master/scripts/auto-install.sh

chmod +x ./auto-install.sh

sudo ./auto-install.sh

Note: If your don’t have curl, use wget instead:

wget https://raw.githubusercontent.com/
remoteit/installer/master/scripts/auto-install.sh

chmod +x ./auto-install.sh

sudo ./auto-install.sh

Execute the following to start connectd:

sudo connectd_installer

Press 1 (Sign in to your existing remote.it account) then press enter.

Then enter the username/password:

Enter for name of your device:

Press 1 (Attach/reinstall  a remote.it Service to an application) then enter:

Press 1 (SSH on port 22) then enter:

Press y then enter for default ssh assignment, (If you have different port assignment on your SSH Service then press ‘n’ then enter the port:

Enter a name for the Service:

Service will be shown in “Installed remote.it Services” once successfully added:

Log-in to remote.it website and check if the device was shown:
You can also monitor here when the device goes offline or online.

Click the device name then list of service will be shown:

Click on the service name and the connection details will be appeared similar to this:

Try the given command: ssh -l username hostname -p ports
Example: ssh -l kmsj13 proxy73.rt3.io -p 31359

Enter ‘yes’ for the prompt, then enter your account’s password.

Voila, you can now execute commands on your Linux machine.
If you want to add other service such as HTTP, VNC, HTTPS, or any service, just simply execute ‘sudo connectd_installer’ and follow the steps above, from the list of protocols, choose the service you want. 🙂

Alternative option for Remot3.it is Dataplicity.com but it is limited to one device only and SSH can be done on their own web terminal.

Remote.it has also mobile application for Android and IOS:

You can monitor and request for service on it 🙂

 

Note: I’m not an employee of remote.it and not paid for advertising their product.

Kevin San Jose, VCP6-DCV

Kevin San Jose, VCP6-DCV

MTCNA, VCP6-DCV, CSS NCII, EIM NCII

Leave a Reply

Your email address will not be published. Required fields are marked *