How to enable SSH server in openSUSE

openssh-server is installed but not automatically enabled in openSUSE. As such, you will not be able to log in via SSH despite of it being installed.

You can enable SSH server for openSUSE both during installation and from the command line when the system is already up and running.

Enable SSH server in openSUSE during installation

You can enable SSH service during openSuSe's installation in the Firewall and SSH section on the Installation Settings screen.

Set the options to the followings:

  • Firewall will be enabled
  • SSH service will be enabled
  • SSH port will be open

Enable SSH server in openSUSE from command line

If you missed the option during installation or simply just need it later, you'll have to manually enable and configure the necessary from the terminal.

  1. Switch to root user.
    > su -
    Password:
  2. Check the current status of sshd daemon to confirm. The status should be Active: inactive (dead).
    # systemctl status sshd
    ● sshd.service - OpenSSH Daemon
       Loaded: loaded (/usr/lib/systemd/system/sshd.service; disabled; vendor preset: disab>
       Active: inactive (dead)
  3. Start sshd service vis systemd.
    # systemctl start sshd
  4. Check if sshd is successfully started.
    # systemctl status sshd
    ● sshd.service - OpenSSH Daemon
       Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: disabl>
       Active: active (running) since Sat 2018-06-02 23:06:28 +08; 41s ago
     Main PID: 10407 (sshd)
        Tasks: 1
       CGroup: /system.slice/sshd.service
               └─10407 /usr/sbin/sshd -D
    
    Jun 02 23:06:28 linux-tgtg systemd[1]: Starting OpenSSH Daemon...
    Jun 02 23:06:28 linux-tgtg sshd-gen-keys-start[10403]: Checking for missing server keys>
    Jun 02 23:06:28 linux-tgtg sshd-gen-keys-start[10403]: ssh-keygen: generating new host >
    Jun 02 23:06:28 linux-tgtg sshd[10407]: Server listening on 0.0.0.0 port 22.
    Jun 02 23:06:28 linux-tgtg sshd[10407]: Server listening on :: port 22.
    Jun 02 23:06:28 linux-tgtg systemd[1]: Started OpenSSH Daemon.
  5. Set sshd to automatically start during boot.
    # systemctl enable sshd
    Created symlink /etc/systemd/system/multi-user.target.wants/sshd.service → /usr/lib/systemd/system/sshd.service.
  6. Enable firewall rule for ssh.
    # firewall-cmd --permanent --add-service=ssh
    success
  7. Reload firewall rules.
    # firewall-cmd --reload
    success