mirror of
https://github.com/linuxserver/docker-mods.git
synced 2026-03-23 00:05:28 +08:00
Merge pull request #766 from barhun/openssh-server-ssh-tunnel
Add the parameter SHELL_NOLOGIN
This commit is contained in:
commit
bb25535203
@ -6,6 +6,12 @@ In openssh-server docker arguments, set an environment variable `DOCKER_MODS=lin
|
||||
|
||||
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`
|
||||
|
||||
### Mod parameters
|
||||
|
||||
| Parameter | Function | Notes |
|
||||
| :----: | --- | --- |
|
||||
| `SHELL_NOLOGIN` | NoLogin User Shell | Optional, set this to `true` to disable login shell |
|
||||
|
||||
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.
|
||||
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).
|
||||
|
||||
@ -19,6 +25,7 @@ services:
|
||||
image: linuxserver/openssh-server
|
||||
environment:
|
||||
- DOCKER_MODS=linuxserver/mods:openssh-server-ssh-tunnel
|
||||
- SHELL_NOLOGIN=false
|
||||
volumes:
|
||||
- /path/to/appdata/config:/config
|
||||
expose:
|
||||
|
||||
@ -4,3 +4,10 @@
|
||||
sed -i '/^AllowTcpForwarding/c\AllowTcpForwarding yes' /etc/ssh/sshd_config
|
||||
sed -i '/^GatewayPorts/c\GatewayPorts clientspecified' /etc/ssh/sshd_config
|
||||
echo "TcpForwarding is enabled"
|
||||
|
||||
if [ "$SHELL_NOLOGIN" == 'true' ]; then
|
||||
USER_NAME=${USER_NAME:-linuxserver.io}
|
||||
|
||||
usermod --shell /sbin/nologin "$USER_NAME" &&
|
||||
echo "Shell is set to /sbin/nologin for the user $USER_NAME"
|
||||
fi
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user