LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 05-31-2002, 07:34 AM   #1
CyberEE
LQ Newbie
 
Registered: May 2001
Posts: 17

Rep: Reputation: 0
Script for SSH login


I am trying to write a script to login in to a SSH server and run a program. The problem I have is that it will not automatically enter the password, is there any way to do this?
 
Old 05-31-2002, 09:57 AM   #2
sewer_monkey
Member
 
Registered: May 2002
Location: Toronto, ON, Canada
Distribution: Ubuntu, Debian, RedHat/CentOS
Posts: 624

Rep: Reputation: 31
You may want to look into using certificates instead of passwords with SSH... That way you may be able to bypass the password entry.

This is a stab in the dark, as I have no experience setting up SSH with certs.
 
Old 05-31-2002, 10:34 AM   #3
CyberEE
LQ Newbie
 
Registered: May 2001
Posts: 17

Original Poster
Rep: Reputation: 0
I don't want to change anything, I just want same way of having the password in the script.
 
Old 05-31-2002, 03:26 PM   #4
Noerr
Member
 
Registered: May 2002
Location: Dalec, HU
Distribution: Redhat 7.3
Posts: 696

Rep: Reputation: 30
but why don't you rather start script on remote machine, rather than login there?
 
Old 06-03-2002, 07:10 AM   #5
CyberEE
LQ Newbie
 
Registered: May 2001
Posts: 17

Original Poster
Rep: Reputation: 0
The remote "computer" is more of a device.
 
Old 06-03-2002, 07:13 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
you can't define a password for ssh within a script... that is, by definition, insecure. you will need to use RSA authorisation or similar to lo in that way.
 
Old 06-03-2002, 07:13 AM   #7
MartBrooks
Member
 
Registered: May 2002
Location: London
Distribution: Debian
Posts: 388

Rep: Reputation: 31
Just generate a DSA keypair on the client side and copy the public part to the other server and put it in the authorized_keys file.

Easy.
 
Old 06-03-2002, 07:53 AM   #8
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
hmm, ok i've got openssh 3.1 on this machine and 2.5 on the other, and am trying to sort out 2 way ssh2 authentication... i've got it now going from this one (md82) to the server (rh71) on ssh1 and ssh2 (rsa and dsa) but coming back the other way i can only get it on ssh1 (identity.pub) the sshd_config files are virtually identical and the log in /var/log/secure doesn't really give me any decent information. everything is a similar as i can see, any obvious stumbling blocks you're aware of?
 
Old 06-03-2002, 08:17 AM   #9
MartBrooks
Member
 
Registered: May 2002
Location: London
Distribution: Debian
Posts: 388

Rep: Reputation: 31
On the server side type, kill the sshd then type:

sshd -v -v -v -d

On the client side type

ssh -v -v -v user@server2

And read the resulting streams of text. If you can't kill the sshd on the server (because you've no physical access to it, for example) add "-p 1022" to both of those lines. This will start another server on port 1022.

Regards
 
Old 06-03-2002, 08:43 AM   #10
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
nah, says it tries each one, then just goes on to the next... doesn't say anything constructive as far as i can see. oh well.
 
Old 06-03-2002, 08:59 AM   #11
MartBrooks
Member
 
Registered: May 2002
Location: London
Distribution: Debian
Posts: 388

Rep: Reputation: 31
If it fails to connect it will give you a reason why.

Mail the traces to me: trace@clues.ltd.uk

This address will only be valid for the next hour or so.

Regards

Last edited by MartBrooks; 06-03-2002 at 09:01 AM.
 
  


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
ssh login only with ip CloudBuilder Linux - Networking 3 07-31-2005 11:20 AM
about ssh login... jsnch Linux - Networking 1 07-05-2005 11:39 PM
ftp login -- ssh no login waffe Linux - General 4 12-27-2003 12:42 AM
SSH Login Again gsibble Linux - Newbie 13 08-11-2003 03:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 06:02 PM.

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