openSUSE

How To Install OpenSSH on openSUSE

Install OpenSSH on openSUSE

In this tutorial, we will show you how to install OpenSSH on openSUSE. OpenSSH is a powerful tool that provides encrypted communication sessions over a computer network using the SSH protocol. It is widely used for secure remote administration, file transfers, and tunneling. openSUSE, a popular Linux distribution known for its stability and ease of use, supports OpenSSH, making it an excellent choice for both beginners and experienced users.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the OpenSSH on openSUSE.

Prerequisites

  • A server running one of the following operating systems: openSUSE (Leap or Tumbleweed)
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. openSUSE provides the Terminal application for this purpose. It can be found in your Applications menu.
  • You’ll need an active internet connection.
  • You’ll need administrative (root) access or a user account with sudo privileges.

Install OpenSSH on openSUSE

Step 1. Update System Packages.

To begin, refresh the package list to ensure you have the latest information about available packages. Open a terminal and run the following command:

sudo zypper refresh
sudo zypper update

The zypper refresh command refreshes the repository cache, while zypper update upgrades all installed packages to their latest available versions. This process may take a few minutes, depending on the number of updates available and your internet connection speed.

Step 2. Installing OpenSSH on openSUSE.

Next, install the OpenSSH package using the zypper package manager. Execute the following command:

sudo zypper install openssh

After installation, verify that the sshd daemon is installed correctly. Run the following command:

which sshd

To start the SSH daemon, use the systemctl command:

sudo systemctl start sshd

To ensure the SSH daemon starts automatically at boot, enable it using the following command:

sudo systemctl enable sshd

To check the status of the sshd service, use the following command:

sudo systemctl status sshd

Step 3. Configuring the Firewall.

By default, openSUSE’s firewall blocks incoming SSH connections. To allow SSH traffic, open port 22 using the firewall-cmd command:

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --reload

Step 4. Basic SSH Configuration.

The SSH configuration file, located at /etc/ssh/sshd_config, allows you to customize the behavior of the SSH daemon. Common configuration options include:

  • PermitRootLogin: Controls whether root login is allowed.
  • PasswordAuthentication: Enables or disables password-based authentication.

To edit the configuration file, use a text editor like nano:

sudo nano /etc/ssh/sshd_config

Make the necessary changes and save the file. For example, to disable root login and password authentication, modify the following lines:

PermitRootLogin no
PasswordAuthentication no

After making changes, restart the sshd service to apply them:

sudo systemctl restart sshd

To test the SSH connection from a client machine, use the ssh command:

ssh user@hostname

Replace “user” with your username and “hostname” with the IP address or domain name of your openSUSE server. The first time you connect, you will see a warning about the host key. Type “yes” to accept and continue.

Step 5. Changing the Default SSH Port.

Changing the default SSH port can enhance security by reducing the risk of automated attacks. To change the port, edit the sshd_config file:

sudo nano /etc/ssh/sshd_config

Locate the line that specifies the port and change it to your desired port number, for example:

Port 2222

Save the file and update the firewall rules to allow traffic on the new port:

sudo firewall-cmd --permanent --add-port=2222/tcp
sudo firewall-cmd --reload

Restart the sshd service to apply the changes:

sudo systemctl restart sshd

Step 6. Setting Up Public Key Authentication.

Public key authentication provides a more secure alternative to password-based authentication. To set it up, generate an SSH key pair on the client machine:

ssh-keygen

Follow the prompts to create the key pair. Next, copy the public key to the server:

ssh-copy-id user@hostname

This command adds the public key to the ~/.ssh/authorized_keys file on the server, allowing you to authenticate using the corresponding private key.

Congratulations! You have successfully installed OpenSSH. Thanks for using this tutorial for installing the OpenSSH on your openSUSE system. For additional or useful information, we recommend you check the official OpenSSH website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button