We have moved to a new Sailfish OS Forum. Please start new discussions there.
0

How to restart/reload sshd

asked 2019-11-29 16:52:38 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2019-11-29 21:23:12 +0200

SebM gravatar image

Hi,

My ssh connections from my PC to my Jolla1 are very very laggy over Wi-Fi : I always have to press to power button and wait a few seconds for the connection to "wake up".

I've enabled the TCPKeepAlive (according to @coderus' comment right below lakutalo's solution) in my /etc/ssh/sshd_config and reloaded the sshd configuration with this but it didn't work, the connection is still very laggy :

$ pgrep -a sshd
12878 sshd: nemo [priv]
12881 sshd: nemo@pts/0 
$ sudo pkill -SIGHUP sshd
Password:              
Connection to 192.168.2.8 closed by remote host.
Connection to 192.168.2.8 closed.
MyPC $ ssh jolla-wlan 
X11 forwarding request failed on channel 0
Last login: Fri Nov 29 15:13:07 2019 from 192.168.2.3

I tried to look for a systemctl sshd service, but it seems the systemctl sshd service is disabled/unused:

$ systemctl list-unit-files | grep ssh                        
sshd-keys.service                         masked  
sshd.service                              disabled
sshd@.service                             static  
sshd.socket                               disabled
$ systemctl status sshd@.service 
Failed to get properties: Unit name sshd@.service is not valid.

BTW : My Jolla1 is running Sailfish OS 3.2

Can you help me restart sshd ?

EDIT 0 : The reboot didn't solve the pb., is the /etc/ssh/sshd_config configuration file ignored ?

EDIT 1 : Why does systemctl list-unit-files says sshd.service is disabled :

$ systemctl list-unit-files sshd.service
UNIT FILE    STATE   
sshd.service disabled

1 unit files listed.

EDIT 2: But systemctl status says it's active and running, ain't it weird ? :

$ systemctl status sshd.service                                               
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/lib/systemd/system/sshd.service; disabled; vendor preset: enabled)
   Active: active (running) since Fri 2019-11-29 19:56:22 CET; 11min ago
  Process: 21554 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
 Main PID: 21491 (sshd)
   CGroup: /system.slice/sshd.service
           └─21491 /usr/sbin/sshd -D

EDIT 3: I've never started sshd on my Jolla1 manually, how come it be running if the sshd.service is disabled ?

edit retag flag offensive close delete

3 Answers

Sort by » oldest newest most voted
1

answered 2019-11-29 20:35:55 +0200

Nieldk gravatar image

updated 2019-11-29 20:36:41 +0200

systemctl restart sshd

(You must be root, so do devel-su first)

edit flag offensive delete publish link more

Comments

@Nieldk OK I see, but then I have one question : why does the systemctl list-unit-files sshd.service command says the sshd.service is disabled :

$ systemctl list-unit-files sshd.service
UNIT FILE    STATE   
sshd.service disabled

1 unit files listed.
SebM ( 2019-11-29 20:50:12 +0200 )edit

Because its disabled, which means, it wont load automatically on boot. It doesnt mean you cant manually start it.

systemctl enable sshd

Will enable it

Nieldk ( 2019-11-29 21:00:04 +0200 )edit

@Nieldk I'm not sure it's not disabled otherwise how can we explain sshd was already running in the beginning of my question :

$ pgrep -a sshd
12878 sshd: nemo [priv]
12881 sshd: nemo@pts/0

BTW : I'm still connected to my Jolla1 by ssh. I'm not using the USB connection anymore

Moreover, the systemctl status sshd.service says it's Active: active (running), how can it be active and running if it's disabled ? :

$ systemctl status sshd.service
● sshd.service - OpenSSH server daemon

       Loaded: loaded (/lib/systemd/system/sshd.service; disabled; vendor preset: enabled)
       Active: active (running) since Fri 2019-11-29 19:56:22 CET; 11min ago
      Process: 21554 ExecReload=/bin/kill -HUP $MAINPID (code=exited, status=0/SUCCESS)
     Main PID: 21491 (sshd)
       CGroup: /system.slice/sshd.service
               └─21491 /usr/sbin/sshd -D
SebM ( 2019-11-29 21:06:53 +0200 )edit

Because its disabled, which means, it wont load automatically on boot. It doesnt mean you cant manually start it.

systemctl enable sshd

Will enable it

coderus ( 2019-11-29 21:21:03 +0200 )edit

@Nieldk I've never started sshd on my Jolla1 manually even when I booted/rebooted it.

How come it be running if the sshd.service is disabled ?

SebM ( 2019-11-29 21:22:27 +0200 )edit
0

answered 2019-11-29 23:43:35 +0200

adekker gravatar image

sshd is not running as a daemon, that's why sshd.service has the state disabled. Ssh sessions are initiated via sshd.socket. When you login remote new sshd session processes are created on the fly.

"systemctl status sshd.socket" will tell you how many sessions are connected.

edit flag offensive delete publish link more
0

answered 2019-11-30 00:24:15 +0200

olf gravatar image

updated 2019-11-30 00:33:46 +0200

Meta-answers:

  • Prevent the phone to enter "CPU sleep" while using ssh, e.g. by having it plugged to a charger.
  • Consult the systemd man-page for instanciated units.
    In this specific case you would have to look for systemctl status sshd@<socket>.service with <socket> replaced by the actual socket in use.
edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
4 followers

Stats

Asked: 2019-11-29 16:52:38 +0200

Seen: 1,275 times

Last updated: Nov 30 '19