Add useradd for sshd

This commit is contained in:
Zach Brown
2024-04-09 21:34:44 +00:00
parent c081b5c63f
commit 59b3bfa6ba
2 changed files with 4 additions and 7 deletions

View File

@@ -1103,14 +1103,14 @@ echo " :+##+. "
wget -O /lib/systemd/system/sshd.service "https://raw.githubusercontent.com/$GITUSER/quectel-rgmii-toolkit/$GITTREE/sshd/sshd.service" 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/" 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 /opt/bin/ssh-keygen -A
systemctl daemon-reload systemctl daemon-reload
systemctl enable sshd systemctl enable sshd
sed -i "s/^.*UsePAM .*/UsePAM yes/" "/opt/etc/ssh/sshd_config" sed -i "s/^.*UsePAM .*/UsePAM yes/" "/opt/etc/ssh/sshd_config"
sed -i "s/^.*PermitRootLogin .*/PermitRootLogin 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 systemctl start sshd

View File

@@ -4,16 +4,13 @@ Documentation=man:sshd(8) man:sshd_config(5)
After=network.target After=network.target
[Service] [Service]
Type=simple
PIDFile=/opt/var/run/sshd.pid
ExecStartPre=/opt/sbin/sshd -t ExecStartPre=/opt/sbin/sshd -t
ExecStart=/opt/sbin/sshd -D ExecStart=/opt/sbin/sshd -D
ExecReload=/opt/sbin/sshd -t
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID
KillMode=process KillMode=process
Restart=on-failure Restart=on-failure
RestartPreventExitStatus=255
Type=notify
RuntimeDirectory=sshd
RuntimeDirectoryMode=0755
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target