LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-21-2010, 05:19 AM   #1
say_hi_ravi
Member
 
Registered: Jan 2008
Posts: 75

Rep: Reputation: 15
provide password through script


I want to automate one script which involves the ssh to other server using another user and then execute command

I want it to be unattended. But now when I ssh it prompts for the password. Is there any facility where I can provide password to the script and and script will run without prompting?
 
Old 08-21-2010, 05:43 AM   #2
billinja
LQ Newbie
 
Registered: Nov 2004
Location: Newmarket, Ontario - Canada
Distribution: Ubuntu
Posts: 9

Rep: Reputation: 0
Hi say_hi_ravi,

I did some digging, and found this post which may answer your question.

Essentially, the preferred way to do this without having to enter a password seems to be to set up public/private SSH keys on both systems. This will allow the remote system to automatically validate the connecting system, and allow you to run ssh commands without typing passwords.

ie. ssh user@remotehost 'df -h'

That one line would simply output the result of that command, as if it were run on the remote host, without requesting a password. Normally, you'd be prompted first for "user"'s password.

Have a read of the post above, and let us know if this is what you're looking for.

Thanks!

Last edited by billinja; 08-21-2010 at 05:45 AM.
 
Old 08-21-2010, 06:26 AM   #3
say_hi_ravi
Member
 
Registered: Jan 2008
Posts: 75

Original Poster
Rep: Reputation: 15
Thanks Jay...at least I got the hint!
 
  


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
how to provide ISP password in Evolution? betula Mandriva 3 07-20-2010 02:59 PM
provide username and password with sendmail rooky Programming 7 12-16-2009 01:41 PM
How to provide password from command prompt ? p_s_shah Solaris / OpenSolaris 5 06-09-2008 07:59 AM
How to provide password for pppd at runtime deepalalla Linux - Networking 0 12-29-2004 04:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:13 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration