install command
Three commands to get it done
sudo apt install ssh -y
sudo ufw allow ssh
sudo ufw reload
process explanation
To install SSH server on Ubuntu 22.04, you can follow these steps:
-
Open the Terminal application: You can use
Ctrl + Alt + T
the shortcut key to open the Terminal application. -
Install the SSH server package: Enter the following command in the terminal
apt
to install the SSH server package using the package manager.sudo apt-get update sudo apt-get install openssh-server
-
Start the SSH server: After the installation is complete, the SSH server will start automatically. If you need to start the SSH server manually, you can use the following command:
sudo systemctl start ssh
-
Configure SSH server: By default, the SSH server is
/etc/ssh/sshd_config
configured using a file. You can use a text editor to modify this file to suit your specific needs. For example, you can change the port number of the SSH server, disable password authentication, enable key authentication, etc. -
Firewall Configuration: If you have a firewall enabled on your Ubuntu 22.04 system, you will need to add the SSH server's port to the firewall's allow list to ensure that you can connect to the SSH server from other computers. You can use the following command to open the SSH server port (the default port is 22):
sudo ufw allow ssh
If you are using a custom port number, you can open it with:
sudo ufw allow [port_number]/tcp
Then, reload the firewall configuration with the following command:
sudo ufw reload
Now that you have successfully installed and configured your SSH server, you can use an SSH client from another computer to connect to and manage your Ubuntu 22.04 system remotely.