[paramiko] SSHClient.exec_command , ChannelException: Administratively prohibited

thk thk at kaotonik.net
Thu Dec 20 11:03:09 PST 2007


Hello.
I am using paramiko.SSHClient in a python application I am building.  I 
am issuing "cd" commands but it seems that SSHClient does not keep the 
session open so if I "cd"  to another directory and issue "pwd" after , 
I am again in my home directory .
I mean every command is like connecting again and being in the ~ directory.
if I issue a command like " cd dir; pwd" then I see from the output of 
pwd that it has changed directory to dir.
But not if I do :
SSHClient.exec_command("cd dir")
SSHClient.exec_command("pwd").

Am I missing something or is this the way paramiko supposed to work?

Also:
In another situation I am connecting with sshclient and then I issue 
commands
on the remote host, at every 5000 milliseconds interval.

After the 10th or so time ,
paramiko sshclient raises an exception:

/  File "/usr/lib/python2.5/site-packages/paramiko/client.py", line 314, 
in exec_command
    chan = self._transport.open_session()
  File "/usr/lib/python2.5/site-packages/paramiko/transport.py", line 
595, in open_session
    return self.open_channel('session')
  File "/usr/lib/python2.5/site-packages/paramiko/transport.py", line 
696, in open_channel
    raise e
ChannelException: Administratively prohibited

/If I catch the exception and try reconnect the loop goes on,
but
I have noticed on the ssh server, that every time the connections 
increase per one.
So as you can figure there are left open connections.
It seems that the SSHClient that raised the exception still has an open 
connection.

So what is this :
/ChannelException: Administratively prohibited/

and how do you propose I should handle this situation, meaning:
A loop that executes some commands on the ssh server at every time interval.
I want to connect once and stay connected and then execute  commands , 
on each interval.
Should i handle exceptions of paramiko?
Ansd then if so, which ?

Any help appreciated.
 Thanks.





More information about the paramiko mailing list