问题
I can't stop the GUI from spawning when a login failure occurs.
simple example that fails and spawns a GUI.
>>> import pxssh
>>>
>>> ssh = pxssh.pxssh()
>>> ssh.force_password = True
>>> ssh.login('127.0.0.1', 'root', 'falsePW')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/pxssh.py", line 226, in login
raise ExceptionPxssh ('password refused')
pxssh.ExceptionPxssh: password refused
>>>
I have tried disabling x11 forwarding in these files, nothing changed.
/etc/ssh/ssh_config
/etc/ssh/sshd_config
I have also tried going into the pxssh module and where it sets the ssh options I set the flag -x Disables X11 forwarding.
still no change.
I am running cinnamon on Linux Mint, the pxssh docs said some x display managers will start up a GUI. To solve this is says to remove all ssh-agents, which I have also tried to no avail.
回答1:
After tampering with the pxssh.py
module I found a solution thats very simple.
inside the pxssh.py module: sudo nano /usr/lib/python2.7/dist-packages/pxssh.py
Location Update: sudo nano /usr/lib/python2.7/dist-packages/pexpect/pxssh.py
class pxssh(spawn)
def _init__( parameters )
# change these variables to shown value
self.force_password = True
self.auto_prompt_reset = False
# next under the login function
def login( parameters )
# set the -x flag: disables x11 forwarding (removing GUI)
ssh_options = '-q -x'
来源:https://stackoverflow.com/questions/20832740/python-pxssh-gui-spawn-on-login-failure