LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to pass password in Shell Script (http://www.linuxquestions.org/questions/linux-newbie-8/how-to-pass-password-in-shell-script-4175430229/)

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: http://www.linuxquestions.org/questi...pt-4175429066/

arun5002 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



http://www.linuxquestions.org/questi...-keygen-35063/

http://www.linuxquestions.org/questi...os-rhel-35029/

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 06:15 AM.