Thus said Kastus Shchuka on Sun, 04 Feb 2024 13:40:58 -0800: > SetEnv Directly specify one or more environment variables and their > contents to be sent to the server.
Thank you this option looks like it could also work, except it's not one of which a user with no permissions can take advantage as the AcceptEnv option is disabled by default on most servers I imagine. So, while a normal user can set the environment for interactive shells, it seems that for non-interactive shells, the only viable solution is to prepend each command with the environment to be set (I see nothing in ksh(1) that suggests that the environment of non-interactive shells are under the control of the user). Also, I don't seem to be succesful in making SetEnv (or SendEnv) work. I've reconfigured (and restarted) sshd_config to have: AcceptEnv PATH Then I configured ~/.ssh/config with: Host localhost SetEnv PATH=/home/amb/bin:/bin:/usr/bin:/usr/local/bin When I run "ssh -v localhost env" I can see that the client sends the path: debug1: channel 1: setting env PATH = "/home/amb/bin:/bin:/usr/bin:/usr/local/bin" debug1: Sending command: env But env reports the following PATH: PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin I also tried using SendEnv but while the client sends the environment, the server seems to ignore it, even if I set the AcceptEnv pattern to *. # sshd -T -C user=amb,host=localhost | grep acceptenv acceptenv PATH When I run "sshd -d -d" I see the following in the output: debug2: Setting env 0: PATH=/home/amb/bin:/bin:/usr/bin:/usr/local/bin So it certainly looks like the server is accepting the path, however, env still reports a different path. Is this perhaps a bug? Maybe step 5 in LOGIN PROCESS is overwriting the PATH that was sent and received by the server? This is on OpenBSD 7.4. Thanks, Andy