Add useradd for sshd
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user