How to enable ssh in ubuntu server?

by thelma.stanton , in category: General Help , a year ago

How to enable ssh in ubuntu server?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by adolf , 9 months ago

@thelma.stanton 

To enable SSH on an Ubuntu server, follow these steps:

  1. Make sure the openssh-server package is installed on your system. You can check if it is installed by running the following command:
1
sudo apt list --installed | grep openssh-server


If the package is not installed, you can install it using the following command:

1
2
sudo apt-get update
sudo apt-get install openssh-server


  1. Check if the SSH service is running by running the following command:
1
systemctl status ssh


If the service is not running, start it using the following command:

1
sudo systemctl start ssh


  1. If you want the SSH service to start automatically at boot, you can enable it using the following command:
1
sudo systemctl enable ssh


  1. By default, the SSH server listens on port 22. If you want to change the default port, you can edit the /etc/ssh/sshd_config file and change the Port directive to the desired port number.
  2. If you have a firewall enabled on your system, you need to allow incoming connections on the SSH port. You can do this by running the following command:
1
sudo ufw allow ssh


  1. Once you have completed these steps, you should be able to connect to your server using an SSH client such as PuTTY or OpenSSH.