authorized_keys Environment Variables Not Setting Environment Variables

Try this:

command="export LEVEL=1; /path/to/script"

First guess is that your syntax is slightly off.

I've never personally used the "environment" argument before, but from having to write custom authorized_keys entries before, I believe that optional arguments at the beginning of an authorized_keys entry require commas between each argument, not spaces.

Try:

command="path/to/script",environment="LEVEL=1" ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEArestofkeyhere comment_stuff

Hope this helps.


There option PermitUserEnvironment in config file /etc/ssh/sshd_config has default value to no

So to enable processing file ~/.ssh/environment or/and environment= options in ~/.ssh/authorized_keys set above variable in yes