How to install OpenSSH server on Ubuntu Linux?
sshd (OpenSSH Daemon) is the daemon program for SSH client. SSH replaces unreliable rlogin and rsh, and give securely encrypted communications between two untrusted hosts over the Internet. Ubuntu Desktop and minimal Ubuntu server don't come sshd installed. Nonetheless, you can undoubtedly install SSH server in Ubuntu using the following steps.
1. Install OpenSSH server
To install openssh-server package, run:
$ sudo apt install openssh-server2. Verify that ssh service running
Run the following systemctl command:
$ sudo systemctl status sshIf not running then run following systemctl command:
$ sudo systemctl enable ssh
$ sudo systemctl start ssh3. Test it
Now you can login from your desktop computer (Linux, macOS, Windows using putty client) using the ssh command:
$ ssh user@server-ipYou can copy and install the public key using ssh-copy-id command for password less login:
$ ssh-copy-id user@server-ipSsh config file
Using ssh config, you can create shortcuts for ssh login. For example, create a file named ~/.ssh/config as follows:
$ vi ~/.ssh/configAdd the following snippet to create login shortcut for your server:
Host web01
HostName server-id
Port 22
IdentityFile ~/.ssh/private_key
User server-usernameTo login run following command on terminal:
ssh web01
Please login or create new account to add your comment.