0

I'm trying to SSH into my VM and did perform a git pull

  • the SSH seems to be working fine
  • the git pull seem to be executed
  • but when I provide password, it doesn't seem to take it
  • Am I missing something ?

I have

import paramiko
import time
import sys
import os
import pdb

# Note
# sudo pip install --user paramiko
ip = "111.111.111.111"
un = "root"
pw = "abc"

def ssh_con (ip, un, pw):
    global ssh
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh.connect(ip, username=un, password=pw)

def cmd_io (command):
    global ssh_cmd
    ssh_cmd.send("%s \n" %command)
    time.sleep(1)
    output = ssh_cmd.recv(10000).decode("utf-8")
    print (output)

ssh_con(ip,un,pw)
ssh_cmd = ssh.invoke_shell()
print ("SSH CONNECTION ESTABLISHED TO %s" % ip)
cmd_io("git pull")
time.sleep(2)
cmd_io(pw)

I kept getting

git pull 
Enter passphrase for key '/root/.ssh/id_rsa': 

Enter passphrase for key '/root/.ssh/id_rsa': 
code-8
  • 54,650
  • 106
  • 352
  • 604
  • First create a `credential.helper` like: http://stackoverflow.com/questions/11403407/git-asks-for-username-everytime-i-push – Hackerman Oct 03 '16 at 20:41

1 Answers1

1

It looks like your SSH Rsa Key pair has been setup up with a pass phrase for root on 111.111.111.111. You can recreate the ssh rsa key with:

ssh-keygen -t rsa

and just leave pass phrase blank.

Matz
  • 371
  • 1
  • 2
  • 5
  • Semantics, but the pass phrase is not for `111.111.111.111`, but for the private key on the local host. And if you recreate the ssh keys, the remote systems will need to know the new public key. – pferate Oct 03 '16 at 21:15