answered
2013-12-28 13:02:11 +0200
Kontio 4995 ●58 ●54 ●63 moderator
In Sailfish OS sshd does not run in daemon mode (there is no need to waste memory for that all the time on a phone!). The process listening on port 22 is init resp. systemd, which on incoming tcp connections on port 22 launches sshd in inetd mode. So changing /etc/ssh/sshd_config
does not do anything.
If you want to change the port you have to edit /lib/systemd/system/sshd.socket
change ListenStream=22
to ListenStream=40233
, then do:
systemctl --system daemon-reload
check with netstat that it's listening on port 40233 now:
netstat -tanpou| grep 40233
tcp 0 0 :::40233 :::* LISTEN 1/init off (0.00/0/0)
That stopping/restarting sshd does not disconnect current session is normal (in this case specially, but also when ran in daemon mode), imagine how many sysadmins would have locked out them self from a machine, when updating sshd or changing the config of sshd which might also lock them out?!
Update:
If you don't want that each update overwrites the setting, you might want to copy /lib/systemd/system/sshd.socket
to /etc/systemd/system
.
I actually changed the port like you described it and after I restarted the ssh service I had to use the new port just as expected. EDIT: OK so appearently it worked for me because I actually started sshd instead of restarting it - after a reboot the changed port failed for me of course.
t4k1t ( 2013-12-28 12:52:06 +0200 )edityeah then you had systemd listening on port 22 and sshd on port 40233 for the moment. But I guess that's not what he wanted.
Kontio ( 2013-12-28 13:15:34 +0200 )edit