How to load environment when using ssh non-inteactive
When you want to load your environment (.profile for instance) when executing a remote command with ssh, you can prefix your key in .ssh/authorized_keys with a commnd snipet like this :
command=". ~/.profile; if [ -n \"$SSH_ORIGINAL_COMMAND\" ]; then eval \"$SSH_ORIGINAL_COMMAND\"; else exec \"$SHELL\"; fi" ssh-dss AAA...
...all on one line.
Written by Michel Blanc
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#