Skip to content

Commit bb25535

Browse files
authored
Merge pull request #766 from barhun/openssh-server-ssh-tunnel
Add the parameter SHELL_NOLOGIN
2 parents 711a3d1 + 7f2c867 commit bb25535

File tree

2 files changed

+14
-0
lines changed
  • root/etc/s6-overlay/s6-rc.d/init-mod-openssh-server-ssh-tunnel-setup

2 files changed

+14
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ In openssh-server docker arguments, set an environment variable `DOCKER_MODS=lin
66

77
If adding multiple mods, enter them in an array separated by `|`, such as `DOCKER_MODS=linuxserver/mods:openssh-server-ssh-tunnel|linuxserver/mods:openssh-server-mod2`
88

9+
### Mod parameters
10+
11+
| Parameter | Function | Notes |
12+
| :----: | --- | --- |
13+
| `SHELL_NOLOGIN` | NoLogin User Shell | Optional, set this to `true` to disable login shell |
14+
915
Note: `GatewayPorts` is set to `clientspecified`, this moves the responsibility to define the gateway host of the port to the client that opens the tunnel, e.g. `*:8080` to forward 8080 to all connection, default is localhost only.
1016
In addition it is still necessary to expose the same port on the container level, using either the `--expose` (only to other containers) or the `--port` (expose on host level/internet) run options (or the counterparts in docker-compose).
1117

@@ -19,6 +25,7 @@ services:
1925
image: linuxserver/openssh-server
2026
environment:
2127
- DOCKER_MODS=linuxserver/mods:openssh-server-ssh-tunnel
28+
- SHELL_NOLOGIN=false
2229
volumes:
2330
- /path/to/appdata/config:/config
2431
expose:

root/etc/s6-overlay/s6-rc.d/init-mod-openssh-server-ssh-tunnel-setup/run

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,10 @@
44
sed -i '/^AllowTcpForwarding/c\AllowTcpForwarding yes' /etc/ssh/sshd_config
55
sed -i '/^GatewayPorts/c\GatewayPorts clientspecified' /etc/ssh/sshd_config
66
echo "TcpForwarding is enabled"
7+
8+
if [ "$SHELL_NOLOGIN" == 'true' ]; then
9+
USER_NAME=${USER_NAME:-linuxserver.io}
10+
11+
usermod --shell /sbin/nologin "$USER_NAME" &&
12+
echo "Shell is set to /sbin/nologin for the user $USER_NAME"
13+
fi

0 commit comments

Comments
 (0)