Ssh is prompting for password | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Ssh is prompting for password

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-08-2013
Mukta Mukta is offline
Registered User
 
Join Date: Jun 2012
Last Activity: 2 April 2013, 1:00 PM EDT
Posts: 6
Thanks: 6
Thanked 0 Times in 0 Posts
Ssh is prompting for password

Hi,

When i am trying to connect to other server using ssh coomand, it is prompting for password.
But i want to hardcode it with username so that it should not prompt for password.

And i dont want to use "ssh-keygen" method as it is not allowed.

Please help me.

Regards,
Mukta
Sponsored Links
    #2  
Old 03-08-2013
franzpizzo's Avatar
franzpizzo franzpizzo is offline
Registered User
 
Join Date: Feb 2013
Last Activity: 6 February 2014, 9:56 AM EST
Posts: 68
Thanks: 0
Thanked 12 Times in 12 Posts
Hi, if in your system is installed the expect command you can interface it with the ssh.
The Following User Says Thank You to franzpizzo For This Useful Post:
Mukta (03-31-2013)
Sponsored Links
    #3  
Old 03-08-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 1 September 2014, 10:35 PM EDT
Location: Saskatchewan
Posts: 19,272
Thanks: 774
Thanked 3,237 Times in 3,035 Posts
Quote:
Originally Posted by Mukta View Post
And i dont want to use "ssh-keygen" method as it is not allowed.
If they don't even allow ssh-keygen, I'm sure they'd be horrified to have you kludging stored plaintext passwords into the login prompt with the expect third-party brute-forcing tool.

Keys are the safe and secure way to do it. If you're not allowed, you're only left with insecure methods.
The Following User Says Thank You to Corona688 For This Useful Post:
Mukta (03-31-2013)
    #4  
Old 03-08-2013
rbatte1 rbatte1 is offline Forum Staff  
Moderator
 
Join Date: Jun 2007
Last Activity: 29 August 2014, 12:30 PM EDT
Location: Lancashire, UK
Posts: 1,754
Thanks: 562
Thanked 298 Times in 267 Posts
Quote:
Originally Posted by Mukta View Post
Hi,

.... i want to hardcode it with username so that it should not prompt for password.

And i dont want to use "ssh-keygen" method as it is not allowed.

Please help me.

Regards,
Mukta

A terrible position. Have you asked why generating a key pair is not allowed? Our security team are very hot on searching for anything that has hard-coded values.

Perhaps I'm miss-reading your message though. Are you actually saying that you are connected to your local server as User1, but you need to connect to the remote server as User2 perhaps? That is still achievable with keys and therefore a password-less connection.

Another option that you may be trying to explain is that the remote server does not accept SSH connections. Is that the case perhaps?

Can you clarify exactly what you have and what you need to achieve. Have you actually tried to run ssh-keygen? Did you get any output to screen or any files generated in sub-directory .ssh?


Hard-coding is always a bad idea. At worst, your code should read the values from a file that you can protect a bit further.



Robin
Liverpool/Blackburn
UK
The Following User Says Thank You to rbatte1 For This Useful Post:
Mukta (03-31-2013)
Sponsored Links
    #5  
Old 03-31-2013
Mukta Mukta is offline
Registered User
 
Join Date: Jun 2012
Last Activity: 2 April 2013, 1:00 PM EDT
Posts: 6
Thanks: 6
Thanked 0 Times in 0 Posts
@ franzpizzo

Thank u for the suggestion.

But expect command is not installed. Any other solution expect keygen?

And sorry for the late reply as i was on vacation.

---------- Post updated at 10:08 PM ---------- Previous update was at 10:00 PM ----------

@rbatte1

My designer has told not to use ssh-keygen as customer is not ok with that.
And it is good if we actually hard code.
Can u pls suggest how to hardcode that?
My code is like below


Code:
#!/bin/sh
ssh uname@ip_add

I thought it might be possible to do something like below like we do in sqlplus, but it doesnt work.


Code:
#!/bin/sh
ssh uname/pwd@ip_add

Thanks
Mukta
Sponsored Links
    #6  
Old 04-01-2013
Chubler_XL's Avatar
Chubler_XL Chubler_XL is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 2 September 2014, 12:22 AM EDT
Posts: 2,821
Thanks: 106
Thanked 885 Times in 828 Posts
Short answer here is that ssh doesn't support any method of supplying a password on the command line.

You basically have two modes of operation A) public/private key pairs and passwordless authentication B) Password entered by a human at the keyboard.

expect uses kludges to trick ssh into thinking it is receiving input from a user.

If you could supply more about what you are trying to automate on the remote server using ssh we may be able to come up with some alternatives (cron jobs running on the remote server for example).
The Following User Says Thank You to Chubler_XL For This Useful Post:
Mukta (04-02-2013)
Sponsored Links
    #7  
Old 04-02-2013
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 1 September 2014, 10:35 PM EDT
Location: Saskatchewan
Posts: 19,272
Thanks: 774
Thanked 3,237 Times in 3,035 Posts
Quote:
Originally Posted by Chubler_XL View Post
Short answer here is that ssh doesn't support any method of supplying a password on the command line.
This is not to annoy you, either -- this is is a security measure. Plaintext passwords are almost impossible to keep safe.

Over the commandline, for instance, your password would show up in ps.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
[SSH-RSA] Still prompting for password after generating keys fzd UNIX for Dummies Questions & Answers 6 01-16-2013 04:18 AM
prompting for passwords even i configured ssh password less authentication rehantayyab82 Red Hat 15 11-07-2012 09:24 AM
ssh via java prompting for password nrworld Programming 3 08-25-2010 11:57 AM
sftp prompting for password dsravan UNIX for Dummies Questions & Answers 1 05-03-2007 07:47 PM
SSH - Prompting for password shihabvk UNIX for Advanced & Expert Users 8 08-21-2006 06:07 PM



All times are GMT -4. The time now is 02:42 AM.