From 59b3bfa6bafc05e870d2b0a7397bbf9e32a9a1fb Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 9 Apr 2024 21:34:44 +0000 Subject: [PATCH] Add useradd for sshd --- RMxxx_rgmii_toolkit.sh | 4 ++-- sshd/sshd.service | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/RMxxx_rgmii_toolkit.sh b/RMxxx_rgmii_toolkit.sh index 39fcf7d..ac2aa10 100644 --- a/RMxxx_rgmii_toolkit.sh +++ b/RMxxx_rgmii_toolkit.sh @@ -1103,14 +1103,14 @@ echo " :+##+. " wget -O /lib/systemd/system/sshd.service "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/sshd/sshd.service" ln -sf "/lib/systemd/system/sshd.service" "/lib/systemd/system/multi-user.target.wants/" - opkg install openssh-server-pam + opkg install openssh-server-pam shadow-useradd /opt/bin/ssh-keygen -A systemctl daemon-reload systemctl enable sshd sed -i "s/^.*UsePAM .*/UsePAM yes/" "/opt/etc/ssh/sshd_config" sed -i "s/^.*PermitRootLogin .*/PermitRootLogin yes/" "/opt/etc/ssh/sshd_config" - adduser -u 106 -G nogroup -h /opt/var/run -s /bin/nologin -S -D -H sshd + useradd -u 106 -g nogroup -d /opt/var/run -s /bin/nologin -r -N -M sshd systemctl start sshd diff --git a/sshd/sshd.service b/sshd/sshd.service index 6ad757c..f6c3ca8 100644 --- a/sshd/sshd.service +++ b/sshd/sshd.service @@ -4,16 +4,13 @@ Documentation=man:sshd(8) man:sshd_config(5) After=network.target [Service] +Type=simple +PIDFile=/opt/var/run/sshd.pid ExecStartPre=/opt/sbin/sshd -t ExecStart=/opt/sbin/sshd -D -ExecReload=/opt/sbin/sshd -t ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure -RestartPreventExitStatus=255 -Type=notify -RuntimeDirectory=sshd -RuntimeDirectoryMode=0755 [Install] WantedBy=multi-user.target