LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-13-2010, 05:56 AM   #1
ajeetsinghraina
Member
 
Registered: May 2010
Location: India
Distribution: Ubuntu 7.04/8.04/8.10/10.04, RHEL 6, OpenSUSE,Mandriva,Fedora, CentOS, XandrOS, Slackware, OpenSolar
Posts: 155

Rep: Reputation: 55
How to add password paramtre to ssh command?


I dont want to use ssh key authentication.
I have a simple script which I need to ssh to remote machine and all I want is to supply the password on the same ssh commandline?
Is it possible?
 
Old 05-13-2010, 06:35 AM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,244

Rep: Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475
Quote:
Originally Posted by ajeetsinghraina View Post
I dont want to use ssh key authentication.
I have a simple script which I need to ssh to remote machine and all I want is to supply the password on the same ssh commandline?
Is it possible?
No. If you don't want to use key authentication, SSH will prompt you for a password. If you're trying to script something, you can use expect to send the password.
 
Old 05-13-2010, 06:36 AM   #3
ajeetsinghraina
Member
 
Registered: May 2010
Location: India
Distribution: Ubuntu 7.04/8.04/8.10/10.04, RHEL 6, OpenSUSE,Mandriva,Fedora, CentOS, XandrOS, Slackware, OpenSolar
Posts: 155

Original Poster
Rep: Reputation: 55
Code:
you can use expect to send the password
Can you elaborate?
 
Old 05-13-2010, 06:52 AM   #4
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 18 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290Reputation: 1290
Hello,

I use sshpass on my Debian servers to send the complete connection and command string from within my scripts. Should be in your repositories, if not have a look at Google.
I use it like this:
Code:
sshpass -p 'password' ssh user@server 'command'
Kind regards,

Eric
 
Old 05-13-2010, 07:06 AM   #5
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,244

Rep: Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475Reputation: 2475
Quote:
Originally Posted by ajeetsinghraina View Post
Code:
you can use expect to send the password
Can you elaborate?
Expect script tutorials can easily be found on Google.

EricTRA...nice one. Never even heard of that particular goodie. I'd always swap keys, or use Perl or expect to knock out something. Probably perl, since (I think), it's a bit more robust.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh-agent, ssh-add and ssh-keygen AND CVS raylpc Linux - General 2 11-19-2008 02:50 AM
specifying password in the ssh command alix123 Linux - Software 2 06-03-2007 04:00 AM
Can you specift password on SSH command line? The_JinJ Linux - Newbie 4 07-26-2005 05:55 AM
Pass password with ssh command BruceC Linux - Newbie 2 05-12-2004 08:55 AM
remote command over ssh, password prompt linowes Linux - General 2 10-27-2002 08:22 PM


All times are GMT -5. The time now is 03:35 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration