os.environ.get('SSH_ORIGINAL_COMMAND') returns None

Yinon Ehrlich yinon.me at gmail.com
Tue Dec 16 09:32:20 EST 2008


On Dec 15, 8:51 pm, Tzury Bar Yochay <Afro.Syst... at gmail.com> wrote:
> Trying to follow a technique found at bzr I did the following
>
> added to ~/.ssh/authorized_keys the command="my_parder" parameter
> which point to a python script file named 'my_parser' and located in /
> usr/local/bin  (file was chmoded as 777)
>
> in that script file '/usr/local/bin/my_parser' I got the following
> lines:
>
> #!/usr/bin/env python
> import os
> print os.environ.get('SSH_ORIGINAL_COMMAND', None)
>
> When trying to ssh e.g. 'ssh localhost'
> I get None on the terminal and then the connection is closed.
>

You should define SSH_ORIGINAL_COMMAND in environment of the calling
shell/application.



More information about the Python-list mailing list