LinuxQuestions.org
Review your favorite Linux distribution.
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-26-2008, 04:21 PM   #1
creatorrr
Member
 
Registered: Nov 2007
Posts: 40

Rep: Reputation: 15
Auto SSH-login expect script


Hi All,

I will need to create a shell script which will automatically login to a Juniper Firewall via ssh. Obviosly the script will need to be able to send the password. I read somewhere that the recomended method to do is using ssh-key-gen, however the Juniper has only limited CLI commands and i am not sure this method will work as i will need to upload the key file. Another method is to create an expect script. I tried to create but i am missing something. As the ssh login will be only local the fact that the pass will be stored in a file in clear text it is not a big issue. Could someone please help me with creating an expect script?

Thank you very much
 
Old 02-26-2008, 05:57 PM   #2
x_terminat_or_3
Member
 
Registered: Mar 2007
Location: Plymouth, UK
Distribution: Fedora Core, RHEL, Arch
Posts: 342

Rep: Reputation: 38
Hi

Most sane people would not help you with this, even if they knew how because making this public knowledge lowers the threshold for script 'kiddies' to make even more brute force ssh attackers.

That being said, I certainly recommend using a host key and disabling password logins. I am sysadmin at work and as soon as I disabled password logins on SSH, and looking at the logs, the SSH server disconnects the 'client' before it can even try to send a password.
 
Old 02-26-2008, 10:10 PM   #3
creatorrr
Member
 
Registered: Nov 2007
Posts: 40

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by x_terminat_or_3 View Post
Hi

Most sane people would not help you with this, even if they knew how because making this public knowledge lowers the threshold for script 'kiddies' to make even more brute force ssh attackers.

That being said, I certainly recommend using a host key and disabling password logins. I am sysadmin at work and as soon as I disabled password logins on SSH, and looking at the logs, the SSH server disconnects the 'client' before it can even try to send a password.
Thanks for your advise. We have to use ssh passwords for various reasons. The ssh login expect script is publically accessible on internet for everyone and it is here:

http://bash.cyberciti.biz/security/sshlogin.exp.php

I believe if it was such a big threat it would be more dificult to find the info.

I was following the script and it is working fine now.
 
Old 02-26-2008, 10:25 PM   #4
BrianK
Senior Member
 
Registered: Mar 2002
Location: Los Angeles, CA
Distribution: Debian, Ubuntu
Posts: 1,334

Rep: Reputation: 51
Quote:
Originally Posted by creatorrr View Post
Thanks for your advise. We have to use ssh passwords for various reasons. The ssh login expect script is publically accessible on internet for everyone and it is here:

http://bash.cyberciti.biz/security/sshlogin.exp.php

I believe if it was such a big threat it would be more dificult to find the info.

I was following the script and it is working fine now.
That's pretty cool. Glad I subscribed to this post... I always wondered how to do this without the use of public keys. Ssh'ing into devices like switches or PDU's is always a pain to do through scripts.


Last edited by BrianK; 02-26-2008 at 10:28 PM.
 
Old 02-26-2008, 10:30 PM   #5
creatorrr
Member
 
Registered: Nov 2007
Posts: 40

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by BrianK View Post
Ssh'ing into devices like switches or PDU's is always a pain to do through scripts.
I totally agree
 
Old 09-22-2011, 05:22 AM   #6
cm3l1k1
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Rep: Reputation: Disabled
Hi,

in this script you can find workaround for fingerprint as well for sudo.

http://www.security-portal.cz/clanky...le-servers-ssh

I hope it will be useful.

Thank you
 
Old 10-26-2011, 01:52 AM   #7
xoir
LQ Newbie
 
Registered: Oct 2011
Posts: 1

Rep: Reputation: Disabled
Hey Martin I found your script very interesting, right now Im Trying to solve a nasty situation Regarding the "one time password" in ssh autentication, at this point we frankenscript's work based on the ip.list, and log_file command.list for backups, But I'm in a situation WHERE 500 routers use one time password - the hardware based tokens (-I know) I've Trying to figure it out how can i loop the ssh authentication When a new IP is read from ip.sheet it manually / interactively authenticate every device When the script's close and read the next IP addresses fro the ip.list, But got no idea how Could I aproach this issue? CAN you give me some advice? Thanks, Xoir
 
Old 10-26-2011, 03:09 AM   #8
cm3l1k1
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Rep: Reputation: Disabled
Quote:
Originally Posted by xoir View Post
Hey Martin I found your script very interesting, right now Im Trying to solve a nasty situation Regarding the "one time password" in ssh autentication, at this point we frankenscript's work based on the ip.list, and log_file command.list for backups, But I'm in a situation WHERE 500 routers use one time password - the hardware based tokens (-I know) I've Trying to figure it out how can i loop the ssh authentication When a new IP is read from ip.sheet it manually / interactively authenticate every device When the script's close and read the next IP addresses fro the ip.list, But got no idea how Could I aproach this issue? CAN you give me some advice? Thanks, Xoir
If you have relation 1 to 1 (IP address and password), you can create password file and read pass for each line same as for IP address.
 
  


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
auto-login script for connecting to remote m/n by using telnet/ftp/ssh Uday123 Programming 5 10-12-2011 11:31 AM
How to configure auto login & after login auto startup some program. hocheetiong Linux - Newbie 1 02-18-2008 12:49 AM
How to enable auto login using a shell script gauravtiwari21 Linux - Security 4 10-20-2007 02:55 AM
How can I auto login to ssh server? sailershen Linux - General 1 04-17-2006 01:04 AM
ssh or telent auto login prashant_1012 Programming 1 11-22-2005 01:12 PM

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

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