11-12-2017, 03:34 PM
Hello,
I just upgraded to 2.0.3 Beta and I notice there is no way I can manage to make sshd to work on a different port than 22.
I think to remember it used to happen in previous versions and that I got it working, but cannot remember how.
Steps to reproduce:
Flash a clean 2.0.3 image. After start for the first time edit /etc/ssh/sshd_config:
Uncomment the #Port 22 line and change to any suitable port.
Restart the board, and see how SSH is still on port 22, and under init process, not sshd as it should be:
If you manually restart the process, it get's started but init process and port 22 remains there:
I have tried to add network service as a dependency to /etc/init.d/ssh and force the restart on rc.local without success.
The file /etc/network/if-up.g/openssh-server whit is intended to fix this issue, is on it's place and looks good to me:
What is supposedly the method to change SSH port on TinkerOS?
Br,
Tony
I just upgraded to 2.0.3 Beta and I notice there is no way I can manage to make sshd to work on a different port than 22.
I think to remember it used to happen in previous versions and that I got it working, but cannot remember how.
Steps to reproduce:
Flash a clean 2.0.3 image. After start for the first time edit /etc/ssh/sshd_config:
Code:
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options override the
# default value.
Port 2222
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::Uncomment the #Port 22 line and change to any suitable port.
Restart the board, and see how SSH is still on port 22, and under init process, not sshd as it should be:
Code:
$ sudo netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:5355 0.0.0.0:* LISTEN 632/systemd-resolve
tcp6 0 0 :::22 :::* LISTEN 1/init
tcp6 0 0 :::5355 :::* LISTEN 632/systemd-resolveIf you manually restart the process, it get's started but init process and port 22 remains there:
Code:
$ sudo systemctl restart sshd.service
$ sudo netstat -ntpl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN 663/sshd
tcp 0 0 0.0.0.0:5355 0.0.0.0:* LISTEN 632/systemd-resolve
tcp6 0 0 :::22 :::* LISTEN 1/init
tcp6 0 0 :::2222 :::* LISTEN 663/sshd
tcp6 0 0 :::5355 :::* LISTEN 632/systemd-resolveI have tried to add network service as a dependency to /etc/init.d/ssh and force the restart on rc.local without success.
The file /etc/network/if-up.g/openssh-server whit is intended to fix this issue, is on it's place and looks good to me:
Code:
cat /etc/network/if-up.d/openssh-server
#! /bin/sh
# Reload the OpenSSH server when an interface comes up, to allow it to start
# listening on new addresses.
set -e
# Don't bother to restart sshd when lo is configured.
if [ "$IFACE" = lo ]; then
exit 0
fi
# Only run from ifup.
if [ "$MODE" != start ]; then
exit 0
fi
# OpenSSH only cares about inet and inet6. Get ye gone, strange people
# still using ipx.
if [ "$ADDRFAM" != inet ] && [ "$ADDRFAM" != inet6 ]; then
exit 0
fi
# Is /usr mounted?
if [ ! -e /usr/sbin/sshd ]; then
exit 0
fi
if [ ! -f /run/sshd.pid ] || \
[ "$(ps -p "$(cat /run/sshd.pid)" -o comm=)" != sshd ]; then
exit 0
fi
# We'd like to use 'reload' here, but it has some problems; see #502444. On
# the other hand, repeated restarts of ssh make systemd unhappy
# (#756547/#757822), so use reload in that case.
if [ -d /run/systemd/system ]; then
systemctl reload --no-block ssh.service >/dev/null 2>&1 || true
else
invoke-rc.d ssh restart >/dev/null 2>&1 || true
fi
exit 0What is supposedly the method to change SSH port on TinkerOS?
Br,
Tony



![[-]](https://tinkerboarding.co.uk/forum/images/collapse.png)
