LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-05-2007, 07:31 AM   #1
Paul77
LQ Newbie
 
Registered: Feb 2007
Posts: 12

Rep: Reputation: 0
Login script


Hi,
I am trying to write a bash login script for
Montavista Linux. I copied one from off the net:-


#!/bin/bash

read parameter1

spawn ssh pblades@smokey

# Look for password prompt
expect "*?assword:*"
# Send password aka $password
send -- "$parameter1\r"
# send blank line (\r) to make sure we get back to gui
send -- "\r


but the line,

spawn ssh pblades@smokey

and in fact any use of spawn is rejected as
an unknown command.


Does anyone know why this might be and if there
is an alternative?


Thanks
Paul
 
Old 02-05-2007, 08:00 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,634

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Could be two reasons:

Spawn isn't installed, or isn't in your path. As super-user, run this:

find / -name spawn

It'll chew for a while, then (if spawn is found), tell you where it is. You can either specify the entire path in the login script, or you can modify your PATH environment variable to put spawn in a place where it's found.

If it's not installed, you'll have to install it if you want to use it.
 
Old 02-05-2007, 08:01 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
From this post it is not very clear what you are trying to do, however the script looks like an expect piece of code. Indeed, spawn is not a linux command by itself, but you have to install expect in order to run this kind of script.
 
Old 02-05-2007, 01:02 PM   #4
Paul77
LQ Newbie
 
Registered: Feb 2007
Posts: 12

Original Poster
Rep: Reputation: 0
I don't appear to have spawn on the system - do you know
where to download it from?

Paul
 
Old 02-05-2007, 02:50 PM   #5
Paul77
LQ Newbie
 
Registered: Feb 2007
Posts: 12

Original Poster
Rep: Reputation: 0
login script

Re: what is the script trying to do

The script is intended to carry out a login via
ssh pblades@smokey
and send a stored password back to complete the
login (it will then go onto set a clear case view and source my .bash_profile)

rgds
Paul
 
Old 02-06-2007, 12:05 AM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by Paul77
I don't appear to have spawn on the system - do you know
where to download it from?
I don't know what Montavista Linux uses... but look for expect in its software installation tool.
 
Old 02-06-2007, 06:43 AM   #7
Paul77
LQ Newbie
 
Registered: Feb 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Hi,
I have changed the script so it does not do the ssh login line
in background (& removed) but it now simply prompts the
user for the password. Running the script in debug (bash -x <script>) the expect "....password:" line after the ssh is not
being carried out.


PB
 
Old 02-07-2007, 11:38 AM   #8
Paul77
LQ Newbie
 
Registered: Feb 2007
Posts: 12

Original Poster
Rep: Reputation: 0
Hi,
the problem appears to be that there is no spawn program
on Montavista linux does anyone know where it can be downloaded
from and if its then safe to use?


PB
 
Old 02-07-2007, 03:03 PM   #9
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Yeah... we already pointed it out. Spawn is a command coming from expect. See the link I have posted above. I have no knowledge about Montavista and what kind of software installer it uses, but for sure you can figure out how to accomplish this task. Last chance: install from source after downloading it from the expect site.
 
  


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
How to check in a script whether the shell is login or non login? frankie_DJ Programming 7 10-21-2015 10:09 AM
Need a login script stefaandk Linux - Newbie 4 01-05-2006 04:24 PM
login script steve007 General 5 07-01-2005 08:49 AM
Login script unclejessie77 Programming 5 02-24-2005 12:30 PM
login script notREALly Linux - General 6 11-29-2003 08:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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