LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   read user password from a file in linux during ssh (https://www.linuxquestions.org/questions/linux-newbie-8/read-user-password-from-a-file-in-linux-during-ssh-4175529312/)

shipon_97 12-27-2014 03:29 AM

read user password from a file in linux during ssh
 
Please look @ below script :

---
[root@rptsvr ~]# cat test.sh
#!/bin/sh
echo "Enter the ip: "
read ip
echo "Please type user name :"
read username
ssh $username@$ip << !
---
Here In this script I want to use a text file (for example , pass.txt) to take the password during password prompt .And login to the specified server .

The pass.txt file contains the password serially , like

-------------
cat pass.txt
oracle
Oracle
linux
-------------

Is it possible to do ?

unSpawn 12-27-2014 06:47 AM

This is ill-advised: instead use pubkey auth as per the SSH best practices. Also please explain what you need those logins for because there may be different, safer ways to accomplish certain tasks.


All times are GMT -5. The time now is 09:52 PM.