|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
SSH with a --password command line???
Has anyone heard of an OpenSSH client being compiled with an additional command-line option for password input? I realize there are reasons to NOT do this, and I realize you can achieve the same type of thing with keys, but I am specifically looking to pass the username & password BOTH on the command line... (IE - allowing for one-shot remote commands) Code:
# myssh root@10.20.30.40 --password=myP@ssw0rd "uname -a" currently there is a script in place of myssh that uses Expect and Tcl to capture the output of the system-default SSH, but I would like to get rid of it and use a straight binary if possible. Any ideas? Or should I go back to brushing up on my C/C++ and compile the option into my own version called 'myssh'? |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
You could use 'expect' and a wrapper script to do it I guess.
Edit: Ah, I see you've already done this, I really should read properly ![]() Last edited by Smiling Dragon; 02-28-2008 at 09:38 PM.. |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
Quote:
I even tried re-creating the same script with the Python PxSSH module (using pExpect module) and came up with ultimately the same exact hangup: Quote:
|
|
#4
|
||||
|
||||
|
... maybe I am missing something here. You want to do one-shot remote commands? Why can't you do that with the 'regular" ssh and keys?
|
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
The scenario is as follows:
You have a "system" that is comprised of N servers. This system can change in size both plus and minus (from 1 to 512 - just for kicks) individual servers. These replacements/additions all have unique IP addresses, but have a broadcast response system that can identify "all the other IPs that I need to talk to". ("I" being the server) Given MY way, I do not need to do ANYTHING except run a bash script that uses MY SSH, logs in to every server, runs whatever I want, and pushes the output back to my terminal. This version of SSH would reside on MY machine, and would be completely compliant with their SSH daemon... Using keys, I have to at a minimum send a file (the key) to the remote machine before communication, and that may be fine for ME to do in the lab. For someone in the field, (aka NOT me) I don't want to have to explain the details of Passwordless SSH & Keys. Especially to somebody that doesn't want/need to know. Is this really that bizarre of a concept? |
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
will this work ? cat myssh.tcl Code:
#!/usr/bin/expect
set timeout -1
if { $argc != 4 } {
puts "Usage $argv0 host user pass command"
exit 1
}
set host [lindex $argv 0]
set user [lindex $argv 1]
set pass [lindex $argv 2]
set command [lindex $argv 3]
spawn sftp -oStrictHostKeyChecking=no -oCheckHostIP=no $user@$host
expect *assword:
send "$pass\r"
expect sftp>
send "$command\r"
expect sftp>
send "exit\r"
expect eof |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script filling password from command line | rockyada | Shell Programming and Scripting | 3 | 01-11-2012 11:38 AM |
| SFTP with Password in Command Line | st3636 | UNIX for Dummies Questions & Answers | 1 | 08-06-2011 01:47 PM |
| FTP command line username and password passing | Pratik4891 | Shell Programming and Scripting | 8 | 06-10-2010 10:33 AM |
| How to use SFTP from command line without entering user and password | Hangman2 | UNIX for Advanced & Expert Users | 7 | 03-07-2009 02:22 AM |
| Single line password reset. | margi973 | UNIX for Dummies Questions & Answers | 2 | 01-20-2004 03:14 AM |
|
|