I have a SSH server that is responsible for running
dwm
binary through X forwarding, on my client computer, i have a shell script that replaces the dwm
binary on /usr/local/bin
, inside that script, i simply make a call to the server requesting it to run the original dwm
:
ssh -q -tt user@172.17.0.2 dwm $@
With only a single -t
, i get the following error:
Pseudo-terminal will not be allocated because stdin is not a terminal
---
On the SSH server side, i'm making use of ForceCommand
to pass the parameters received through a container_runner
script, it looks like this:
#!/bin/sh
/usr/local/bin/$SSH_ORIGINAL_COMMAND
The reason for the ForceCommand
here is to limit the possibility of running anything else other than a set of Docker container initialization scripts (located on /usr/local/bin
)
Here's an example of one of those scripts, the one below runs the dwm
Docker image:
#!/bin/sh
docker run \
--pull=never \
--rm \
-v container-scripts:/container-scripts \
-v ssh-keys:/home/dwm/.ssh \
-v x11-shared:/tmp/.X11-unix \
-it \
-e DISPLAY=:1 \
-e XAUTHORITY=/tmp/.X11-unix/container-cookie \
dwm \
$@ 2>/dev/null
- container-scripts
- volume containing a set of scripts that will allow running others sibling containers inside containers
- ssh-keys
- the SSH keys in order to be able to run containers from inside other containers
- x11-shared
- X11 shared data (X11 socket and xauth cookie)
---
My ssh_config
looks like this:
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
ForwardX11 yes
ForwardX11Trusted yes
PreferredAuthentications=publickey
Things started to get inconsistent after i disabled SSH multiplexing from my ssh_config
, previously with the settings below, it worked fine all the time (which makes no sense, as far as i know, SSH multiplexing shouldn't interfere in that), settings below:
ControlPath /tmp/%r@%h:%p
ControlMaster auto
ControlPersist yes
What happens is that whenever i try to run startx
passing as argument my dwm
script that makes a request to the SSH server to run the actual dwm
, i just get a black screen, and nothing happens, it just stays like that, example below:
startx /usr/local/bin/dwm -- :1
But, if i run the same command above, slightly differently, using shell command substitution alongside with the shell noop operator, it works fine (just takes a few more seconds to show dwm
than usual, probably due to the ugly hack)
: $(startx /usr/local/bin/dwm -- :1)
Asked by henriquehbr
(938 rep)
Mar 30, 2022, 04:25 PM
Last activity: Apr 13, 2022, 10:30 AM
Last activity: Apr 13, 2022, 10:30 AM