On 10/05/2016 10:46 AM, Noah wrote:
I would like to use a python script to ssh into a server using a username and password [...]
I've written a module called scription to help with scripts; it supports giving passwords to programs like ssh. Here's an example from one of my utility scripts: -- 8< --------------------------- #!/usr/local/bin/python from getpass import getpass from antipathy import Path from scription import Command, Execute, Main, OPTION, REQUIRED ... @Command( repo=('repository to pull [default: all]', OPTION), path=('base path to search', OPTION, 'p', Path), ) def pull(repo, *path): ''' retrieve remote change sets ''' password = getpass('[mercurial] password: ') target = repo for repo in workhorse(*path): if target and repo.filename != target: continue history = Execute(('hg', 'pull'), cwd=repo, password=password, pty=True) -- 8< ---------------------------- and in use: ================================== $ hgc --help Available commands/options in hgc incoming displays changesets in remote repo not present locally list displays all repos log-date displays all log entries for matching date outgoing displays changesets in remote repo not present locally parent displays parent of active branch pull retrieve remote change sets push send local changesets to remote repo status display status for each repo update update active files to latest version $ hgc pull [mercurial] password: ... =================================== It's available via pip. Feedback welcome. :) -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list