Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 08-21-2010, 05:19 AM   #1
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
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.


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

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


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 > Forums > Non-*NIX Forums > Programming

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

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