-   Linux - Newbie (
-   -   How to pass password in Shell Script (

shivaa 10-03-2012 02:49 AM

How to pass password in Shell Script
Hello friends,
I am creating a shell script (bach/csh), which I will use to fetch some info. from some application servers. Script will login into each server one by one and will invoke the commands mentioned in it, but I have a problem that how can I pass password for each server?
Let's say scrpit has a line: ssh username@$hostname
Where $hostname is varialbe containing many diferent hosts. But when I am invoking the script, it asks for the password again & again for each server. So is there any way that I can mention that password in script itself and i dont need to type it again and again? Moreover, my appication servers only accept "ssh" connection. and "sshpass" is lso not available.
Thanks in advance.

pan64 10-03-2012 02:50 AM

there are several threads about this:

jsaravana87 10-03-2012 03:57 AM

You have to create ssh passwordless login to connect remote server to fetch information about your remote application server

Look after the link

divyashree 10-04-2012 09:40 AM

Its not recommended to use password in shell script. But if you want to use, you can try with expect to prompt for password and insert password in script.

All times are GMT -5. The time now is 01:44 AM.