Compare commits

...

2 Commits

Author SHA1 Message Date
Daniel Barlow bc27f121d9 /etc/ashrc for interactive non-login shells 2023-05-21 17:08:32 +01:00
Daniel Barlow 0173a9ced9 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
2023-05-21 17:07:19 +01:00
2 changed files with 17 additions and 4 deletions

View File

@ -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
'';
};

View File

@ -146,13 +146,17 @@ in {
console = node "c" "5" "1" "0600";
pts = dir {};
};
etc = dir {
etc = let
profile = symlink
(pkgs.writeScript ".profile" ''
PATH=${lib.makeBinPath config.defaultProfile.packages}:/bin
PATH=${lib.makeBinPath config.defaultProfile.packages}:/bin
export PATH
'');
'');
in dir {
inherit profile;
ashrc = profile;
};
proc = dir {};
run = dir {};
sys = dir {};