SSH, or Secure Shell, is a method for securely sending data across unsafe networks. OpenSSH is a tool that allows you to control another computer remotely through its command line, using SSH to keep the connection safe. This is especially useful for managing servers and accessing files on different computers. It ensures that your data remains encrypted and protected, even over the internet.

Advertisement

Recently, I have installed newly launched Ubuntu 24.04 desktop system inside virtual box. After finishing the installation process, I am able to logged in using desktop environment. Then I noticed that SSH server is not installed by default. Generally it may not required on desktop systems, but if you still needs it, you can turn SSH server on easily. This tutorial will help you to install and turn on SSH on your Ubuntu 24.04. The same instructions will also work on other versions like Ubuntu 23.10, 22.04, and 20.04 etc.

Step 1: Installing OpenSSH Server

You must have physical system access to complete OpenSSH server installation. Login to the Ubuntu system and open a terminal.

  1. Now, run the following commands to install the OpenSSH server on your system.
    sudo apt update 
    sudo apt install openssh-server 
    
  2. Once the packages installation finished, run the below command to check SSH service status:
    sudo systemctl status ssh 
    

    It should be active and running as below:

    Enable SSH in Ubuntu 22.04

  3. Ubuntu comes with a default firewall called UFW. If UFW is active, you’ll need to open SSH port 22 for remote users. To open port 22 in UFW, type the following command:
    sudo ufw allow 22/tcp 
    

You have successfully installed the OpenSSH server on Ubuntu 22.04 system.

Step 2: Connect to SSH Server

Now, if you’re using Windows, you can use third-party applications like Putty to connect. On Linux, simply use the “ssh” command in the terminal to access a remote server using SSH.

ssh user_name@remote_host 

Step 3: Disable SSH Server (Optional)

The systems with physical access are less required SSH access. In that case, you can either block ssh access using the firewall or disable the SSH service on your system.

  • To block SSH access via UFW firewall, type:
    sudo ufw deny 22/tcp 
    
  • You can also completely disable the SSH service (OpenSSH) to prevent remote access.
    sudo systemctl stop --now ssh 
    sudo systemctl disable --now ssh 
    

    The above commands will stop SSH service immediately and disable the autostart of service on system bootup.

Conclusion

This tutorial helps you to install and enable the OpenSSH server on Ubuntu 24.04 and other versions. Once you finished the installation process, You may also like to change the SSH port to secure your system.

Share.
Leave A Reply


Exit mobile version