os/macos/ SshUserEnvironment


By default, the sshd on macos uses a restricted environment. If you want to set your own PATH, you need to define e.g.

PATH=/Users/me/bin:/opt/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin

and then you need to edit /private/etc/ssh/sshd_config and change the following line

PermitUserEnvironment yes

and then restart sshd via

sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist