I want to connect my Linux server securely. Security is important nowadays. OpenSSH is a secure shell for remote connections. OpenSSH is very popular and have very life saver features.
Installation of ssh is like below. ssh full package name is Openssh-server which provides daemon, client and auxiliary tools for ssh.
Ubuntu, Debian, Mint, Kali:
$ sudo apt-get install openssh-server
CentOS, Fedora, RedHat:
$ sudo yum install openssh-server
Start Ssh Service
After installation if service is not started by default. We can start
ssh service with different methods but the most basic way is using
$ sudo /etc/init.d/ssh start
Get Status of Ssh Service
After the service is started we can check the service status with the
status command for
init.d. This will list some information like process ID, memory usage, CPU usage.
$ /etc/init.d/ssh status
Enable SSH Firewall Rule
Firewalls are used to protect servers for attacks.One of the main function is blocking port access. Default Ubuntu installation enables firewall named `ufw`. We will create a rule for `ufw` with the following command.
$ ufw allow ssh
Generate Ssh Key
SSH uses public and private keys. By default SSH do not generate SSH keys by default. We can create SSH keys with the
ssh-keygen like below.
We see from screenshot that RSA key pair is created by default. Created keys are stored in the user home
Connect SSH Server
Now we will made a test connection to the SSH server by providing the host name or IP address.
$ ssh 192.168.142.144