1

Hi I am using NXclient (UNix/KDE) . I am running a python script where it is trying to create ssh session to another server and perform some automation task. Basically I am storing a password in variable and when SSH session asks for password I simply send the stored password. it work very well using putty.

PROBLEM: when I use above nxclient. each time a SSH session needs a password 'A GUI prompt appears asking for password which freezes the terminal and fails my script . I do not want to enter password in gui because the password is already stored in a variable which will be used .

I have attached following screen shot. How can i disable this please help. click for screen shot

[EDIT] section of code which does thatif password_prompt: child.sendline(getpass.getpass('Enter your windows password: ')) else : child.sendline(ssh_password) i = child.expect([os.path.basename(keyfile), pexpect.TIMEOUT])

Ashish Kumar
  • 126
  • 11
  • You could switch to the more secure [public/private key authentication](https://help.ubuntu.com/community/SSH/OpenSSH/Keys) – jDo Apr 14 '16 at 19:45

2 Answers2

0

Well, you have a few options:

  1. Currently your keys are added into ssh-agent with -c option which brings the confirmation dialog asking you to type yes each time a particular key is used. You may remove that -c option from your session startup scripts or change ssh-agent from the default OpenSSH Ssh-Agent to a more fancy (but perhaps less secure) variant which would allow you to store keys only for a session or somehow else etc
  2. Completely disable usage of ssh-agent and supply the passphrase from terminal by unset SSH_AUTH_SOCK environment variable. Be prepared that passphrases can't be read from STDOUT, they require usage of TTYs to handle input (check pexpect)
  3. Switch to passphrase-less keys. In case of keys dedicated to a robot this doesn't seem like a major secure breach owing to the fact that you're going to store the passphrase in plain-text. But probably it'd be better to configure
user3159253
  • 16,836
  • 3
  • 30
  • 56
0

Actually there is another environmenmt variable called DISPLAY . unsetting both DISPLAY and SSH_ASKPASS helped me solve this

Ashish Kumar
  • 126
  • 11