LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-27-2014, 04:29 AM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 484

Rep: Reputation: 30
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 ?
 
Old 12-27-2014, 07:47 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,331
Blog Entries: 55

Rep: Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530Reputation: 3530
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] change password of other user using ssh bloodstreetboy Linux - Newbie 5 09-12-2012 04:55 AM
ssh without password from user to root on same linux enterprise 5 machine linux2010 Linux - Newbie 3 01-24-2010 07:57 PM
user password not accepted when using SSH to a remote linux box emeak Linux - Newbie 2 08-06-2009 08:10 AM


All times are GMT -5. The time now is 04:31 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration