LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 07-08-2009, 11:14 AM   #1
ahmad2080
LQ Newbie
 
Registered: Apr 2008
Distribution: fedora 11
Posts: 19

Rep: Reputation: 0
URGENT: how can I log in to a remote system using a shell script!!!


Here is my small script:

Code:
#!/bin/sh
ssh 10.0.0.5
thepassword
Now when i launch the script, it doesn't log into the remote system but prompts me for the password although I wrote the password in the script..

How can I make the Shell read the password from my script???
 
Old 07-08-2009, 11:32 AM   #2
cejennings_cr
LQ Newbie
 
Registered: Jul 2006
Posts: 5

Rep: Reputation: 0
You cant do this this way - you might look at creating an expect script (just look at autoexpect to get an idea)
 
Old 07-08-2009, 11:42 AM   #3
ahmad2080
LQ Newbie
 
Registered: Apr 2008
Distribution: fedora 11
Posts: 19

Original Poster
Rep: Reputation: 0
You mean at autoexpect in the web??
cause I didn't find it in my man pages.....

Thanks for your help/.
 
Old 07-08-2009, 11:54 AM   #4
Uncle_Theodore
Member
 
Registered: Dec 2007
Location: Charleston WV, USA
Distribution: Slackware 12.2, Arch Linux Amd64
Posts: 896

Rep: Reputation: 71
man expect
http://users.csc.calpoly.edu/~dbutle.../tutorial.html
http://wiki.tcl.tk/1865
 
Old 07-08-2009, 12:34 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
...and if you succumb to typing in your password anyway, why not save time, use ssh-agent and type your passphrase once instead?

Last edited by unSpawn; 07-08-2009 at 12:36 PM. Reason: //I R meek ytppoo
 
Old 07-08-2009, 02:01 PM   #6
ahmad2080
LQ Newbie
 
Registered: Apr 2008
Distribution: fedora 11
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks everybody, I've found this: http://bash.cyberciti.biz/security/e...-login-script/

It describes how to "SSH login expect shell script to supply username and password"....
 
  


Reply



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
Running Shell Script at log in. ceantuco Programming 21 11-05-2008 02:56 PM
URGENT----shell script to change word in file raghupal Programming 14 10-21-2008 12:49 AM
Is it possible to create a remote log host on a free shell account? testpie Linux - Server 3 05-08-2008 07:22 PM
Shell Script For Myspace Log in condonm Programming 1 02-08-2007 06:34 AM
Urgent: Call a C program through Linux shell script nuwandee Programming 14 04-10-2004 07:31 PM

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

All times are GMT -5. The time now is 06:01 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