ssh - Python Fabric and password prompts -


i see there few questions regarding fabric , passwords. know if pass -i fabric password enter passed environmental variable "password." problem i'm prompted password when running ssh command on remote server remote server.

but, don't want prompted password entry. prompted no matter try do. here's little snippet of code:

elif "test" in run('hostname -d'):                 print(blue("gathering knife info"))                 run("ssh mychefserver knife node show `hostname`.test.dmz") 

it works fine when enter password. thing is, don't want have enter password. maybe because ssh connection initiated on remote host , fabric can't that.

i have script disconnect remote host, run ssh command locally, reconnect remote host finish script... seems silly. suggestions?

getpass info:

python 2.6.6 (r266:84292, sep 11 2012, 08:34:23)  [gcc 4.4.6 20120305 (red hat 4.4.6-4)] on linux2 type "help", "copyright", "credits" or "license" more information. >>> getpass import getpass >>> getpass('test: ') test:  'this test' 

from subprocess import popen, pipe getpass import getpass  x = popen('ssh root@host', stdin=pipe, stdout=pipe, stderr=pipe, shell=true)  print x.stdout.readline() _pass = getpass('enter superduper password:') x.stdin.write(_pass) print x.stdout.readline() 

once connected, can still input things if on other machine via x.stdin.write(...) yea, should work?

debug (just start cmd promt, navigate python directory , write python):

c:\users>python python 2.7.3 (default, apr 10 2012, 23:31:26) [msc v.1500 32 bit (intel)] on win32 type "help", "copyright", "credits" or "license" more information.  >>> getpass import getpass >>> getpass('test: ') test: 'this test' >>> 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -