In this article series, I will explain how to use command line terminal to connect to secure shell (SSH) servers, using the config file for quick access to frequently used servers, and setting up an SSH server on macOS, Ubuntu, or CentOS.
Table of Contents:
– SSH CLI Commands
– SSH Config File
– SSH Server Configuration
For instance, we can use vi to open the file:
$sudo vi /etc/ssh/sshd_config
This file is the configuration file for the SSH daemon on your virtual machine. Here, we need to make sure the following line is not commented out using ‘#’ and it is set to ‘yes’:
If we make any changes to this file, we need to restart the ssh service using the following command:
$sudo systemctl restart sshd
Now, we need to find our virtual machine’s IP address (host-only adaptor) to connect to it.
Now, we can open up a terminal on our computer (not inside the virtual machine!) and connect to our virtual machine using the username and password we set during server installation:
In my case, the result looks like this:
$ ssh email@example.com The authenticity of host '192.168.56.3 (192.168.56.3)' can't be established. ECDSA key fingerprint is SHA256:MyF58hvhnjfyBHdQEl9fkpiGyGMG+b1W2LPfzpUQYu4. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.56.3' (ECDSA) to the list of known hosts. firstname.lastname@example.org's password: Last login: Mon Aug 12 00:00:00 2019 [sina@localhost ~]$
Now, we are successfully connected to the virtual machine using SSH! We can run any command on the virtual machine using the terminal on our local computer.
Next article in the series: SSH CLI Commands