Monday, 23 December 2019

How to connect to Linux computer remotely via SSH

It is possible to access the terminal of the Linux machine in the same local network. All we need to know is:

  • account name we want to log in remotely
  • computer's IP address or hostname 

ssh connection

We can do this out of the box if we perform connection from Linux or Mac computer.

From Linux machine, via host name (nvidia-nano in this example; and nvidia as account name):

ssh nvidia@nvidia-nano
The authenticity of host 'nvidia-nano (' can't be established.
ECDSA key fingerprint is SHA256:AeGD/zmVkabo...ab3jLsqBUPjZfirAo.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'nvidia-nano' (ECDSA) to the list of known hosts.
nvidia@nvidia-nano's password: 
Welcome to Ubuntu 18.04.3 LTS (GNU/Linux 4.9.140-tegra aarch64)

 * Documentation:

 * Management:
 * Support:

 * Overheard at KubeCon: "microk8s.status just blew my mind".

This system has been minimized by removing packages and content that are
not required on a system that users do not log into.

To restore this content, you can run the 'unminimize' command.

1 package can be updated.

0 updates are security updates.

Last login: Fri Dec 20 16:39:47 2019 from

We can run ifconfig on remote machine (directly) in order to determine its IP address. Once we know it, the ssh command would be e.g.:

$ ssh nvidia@

If we use the wrong IP address, we might get the following error:

$ ssh nvidia@
ssh: connect to host port 22: No route to host

It is possible to find out the IP address of the computer in local network via nmap tool which scans local network for connected devices. We need to know local network's address and mask:

$ nmap -sn
Starting Nmap 7.80 ( ) at 2019-12-07 23:36 GMT
Illegal character(s) in hostname -- replacing with '*'
Illegal character(s) in hostname -- replacing with '*'
Nmap scan report for xxxRouter (
Host is up (0.015s latency).
Nmap scan report for ***MobilePhone_01*** (
Host is up (0.016s latency).
Nmap scan report for nvidia-nano (
Host is up (0.10s latency).
Nmap scan report for ***AndroidPhone*** (
Host is up (0.100s latency).
Nmap scan report for ***iPhone*** (
Host is up (0.012s latency).
Nmap scan report for ***user-laptop1*** (
Nmap done: 256 IP addresses (7 hosts up) scanned in 3.59 seconds

To run applications that use dialogs (windows) we need to enable X forwarding by passing -X argument to ssh:

$ ssh -X user@host 
user@host: $ gedit

The example above will run gedit on a remote host but will open gedit window on the local host (from which we connect to remote). 

To execute command immediately upon connection, we can pass that command with -C ssh argument:

$ ssh -X user@host -C gedit

To close SSH connection we can use command exit:
nvidia@nvidia-nano:~$ exit
Connection to nvidia-nano closed.

1 comment:

micheal pan said...

BE SMART AND BECOME RICH IN LESS THAN 3DAYS....It all depends on how fast 
you can be to get the new PROGRAMMED blank ATM card that is capable of
hacking into any ATM machine,anywhere in the world. I got to know about 
this BLANK ATM CARD when I was searching for job online about a month 
ago..It has really changed my life for good and now I can say I'm rich and 
I can never be poor again. The least money I get in a day with it is about 
$50,000.(fifty thousand USD) Every now and then I keeping pumping money 
into my account. Though is illegal,there is no risk of being caught 
,because it has been programmed in such a way that it is not traceable,it 
also has a technique that makes it impossible for the CCTVs to detect 
you..For details on how to get yours today, email the hackers on : ( ). Tell your 
loved once too, and start to live large. That's the simple testimony of how 
my life changed for good...Love you all ...the email address again is ;