commit 0173a9ced9bc4e876b6607b7604c24bbedeb489c parent a48d51ffdc8c2a38c36663535f126cb6d8c36e61 Author: Daniel Barlow <dan@telent.net> Date: Sun, 21 May 2023 17:07:19 +0100 set PATH correctly in ssh sessions for a non=interactive shell ("ssh linminix foo") ash does not source *any* startup files, so we need to set this to something more useful than /bin:usr/bin Diffstat:
| M | examples/rotuer.nix | | | 11 | ++++++++++- |
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/examples/rotuer.nix b/examples/rotuer.nix @@ -151,12 +151,21 @@ in rec { services.sshd = longrun { name = "sshd"; + # env -i clears the environment so we don't pass anything weird to + # ssh sessions. Dropbear params are + # -e pass environment to child + # -E log to stderr + # -R create hostkeys if needed + # -P pid-file + # -F don't fork into background + run = '' if test -d /persist; then mkdir -p /persist/secrets/dropbear ln -s /persist/secrets/dropbear /run fi - ${dropbear}/bin/dropbear -E -R -P /run/dropbear.pid -F + PATH=${lib.makeBinPath config.defaultProfile.packages}:/bin + exec env -i ENV=/etc/ashrc PATH=$PATH ${dropbear}/bin/dropbear -e -E -R -P /run/dropbear.pid -F ''; };