Passing password with SSH command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Passing password with SSH command
# 1  
Old 07-03-2013
Passing password with SSH command

Hi Experts,

I have specific requirement where I want to pass the password with the
Code:
ssh username@hostname command .

I dont want to use RSA public and private keys also. Because that will be on production server and no one wants to give access like that.
Second thing it is production servers, We dont want to install any utilities like SSHPASS or expect.

I am lookin for the solution where I can pass it password directly in the command or can read it from one file.

Thanks
# 2  
Old 07-03-2013
As far as i know the whole idea of SSH is dont use or automate password to it. Thats whythey have SSHPASS and except tools to achieve this.
# 3  
Old 07-03-2013
Yeah Agree to you.

But requirement is like I dont have the permission to install any utilities or generating the RSA certificate authentication. In this case do we have any way to pass the password within the script?

In such scenarios, production environment required some rights which generally developer doesnot have it. So how to bypass this thing and directly hardcode the password in the script or read it from some file.

Thanks again. Anyone faced this kind of problem or having any resolution for the same?
# 4  
Old 07-03-2013
So are you saying that you cannot (on the local system) issue ssh-keygen

If you can, can you use SFTP (with user & passwd) to the target server? If it's a unix server, then normally you would need to edit ~/.ssh/authorized_keys and add in the newly generated public key. If it's Windoze, then I'm a bit stuck.

SSH is designed for key exchange really, with user & password being a manual process only. There are ways, but you are then exposing the credentials to anyone who can read the script. I doubt that meets your security and auditing requirements.

Can you elaborate on why you (or the sysadmin of the other server if it's not you) don't want to use keys?




I hope that this helps,
Robin,
Liverpool/Blackburn
UK
# 5  
Old 07-03-2013
Quote:
Originally Posted by sharsour
Yeah Agree to you.

But requirement is like I dont have the permission to install any utilities or generating the RSA certificate authentication.
If you're not allowed to use the safe, secure, normal, day-to-day method of automatic login, it's pretty safe to assume your admin did not intend you to use some wildly insecure kludge to do so instead.

Last edited by Corona688; 07-03-2013 at 12:31 PM..
# 6  
Old 07-04-2013
Yes Rbatte, Here is the explaination.

We have unix boxes in the production which are being replicated on other boxes for disaster recovery. So the script which am writing actually need to run on the DR site. First thing is we wont be having access to install anything on the DR servers and we need to perform immediate test using script. If we issue key certificate also for production servers as it will be replicated to DR servers so the IP and hosts will change for DR. So your key certificates wont work in DR site.

So what solution I was thinking is just passing the password from the scripts only and run using SSH to multiple servers. I agree that SSH keys provide the safe and secure mechanism but sometime more security become bottleneck for straight forward solution.

I appericiate you guys for sticking to standards and guidelines but i need some solution out of the box here.
# 7  
Old 07-04-2013
why not just generate 1 key each for each server in a production-dr server pair inside the ssh keys file? that way replication from production to dr will not clobber the dr servers' ssh key files in any way ...
These 2 Users Gave Thanks to Just Ice For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing password for ssh in Script

I want to do following 2 commands via script: 1) eval `ssh-agent`2) ssh-add /export/home/sufuser/.ssh/id_rsa When asked for passphrase enter "passwordpassword1234 but whenever I run the script it stucks after "ssh-add /export/home/sufuser/.ssh/id_rsa" command and asks fro... (4 Replies)
Discussion started by: yogeshpawar
4 Replies

2. Shell Programming and Scripting

Passing Password to SSH without using expect in a Script

How can I pass password in SSH command without using expect in a shell program. I don't have expect installed on my Solaris server. #!/bin/bash ssh user@hotname (how to supply pass in script?:wall:) Experts please help its very urgent. Shrawan Kumar Sahu (4 Replies)
Discussion started by: ss135r
4 Replies

3. Shell Programming and Scripting

Passing password in script for ssh connection - no except

Used the script posted on forum - unix.com/shell-programming-scripting/21597-script-change-passwords-same-user-multiple-servers.html but the last question posted on this seems to be still unanswered, tried different things with no success, can someone help giving an way to pass the password via... (5 Replies)
Discussion started by: sapadmin
5 Replies

4. Shell Programming and Scripting

passing password to a command

Hi all, I have the expect binaries in our boxes.. I want to pass a passwd to a command automatically without manual intervention using "/<path_of_expect>/expect/<version>/bin/autopasswd" The below command will ask passwd in my script cleartool rmtag -all <vob_tag> #Some... (4 Replies)
Discussion started by: raghu.iv85
4 Replies

5. Shell Programming and Scripting

Passing Password into scp Command

Hi Everyone, I'm trying to run scp as a one-line command, as of right now, it prompts me for the user's password to the remote machine. Does anyone know if there is an option to pass the password parameter into the scp command on the same line so it doesn't prompt me? Thanks! (1 Reply)
Discussion started by: twhitmarsh
1 Replies

6. Shell Programming and Scripting

SSH Login by passing password.

ssh/sftp login by passing password , is it possible.Don't want to expect. (1 Reply)
Discussion started by: dinjo_jo
1 Replies

7. Shell Programming and Scripting

ssh - passing password in shell script

I have a requirement, I need to run a command at remote system using a ssh. Is there any way we can pass the username and password in shell script to the ssh command as we did it in one of the shell script for FTP. ftp -n $i <<!EOF >> user Username $PASSWD cd /home/scripts ... (5 Replies)
Discussion started by: Muktesh
5 Replies

8. Shell Programming and Scripting

Passing SSH Command Parameters

Hi, I wan to pass arguments to remote script in Unix . For that I'm using ssh PFB the code I'm using: ssh -t -l osdac 10.81.33.51 "cd /appl/OSD/LOGS/flstr010/test.sh "$1" "$2"" Problem is I'm not able to pass second argument . Can anyone plz help me in resolving this. (5 Replies)
Discussion started by: suchitasaner27
5 Replies

9. AIX

Passing a command over SSH

I'm trying to run a command over ssh to AIX 5.2, something like: ssh machine ls but it just hangs. I can ssh into the machine and run a command, but can't pass it like above. Is there a security setting that disables this by default? If so, how do I change it? Thanks! (8 Replies)
Discussion started by: hansnueski
8 Replies

10. Solaris

Passing SSH Command Parameters

On Solaris 5.9, is there any way to pass parameter(s), via SSH, to a command defined in the remote host's authorized_keys file? We have a menu that uses SSH to control some apps on our various hosts. I've been tasked with enhancing it and making it more secure. So far, the local host menu... (2 Replies)
Discussion started by: PabloCruise77
2 Replies
Login or Register to Ask a Question