LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 03:29 AM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 504

Rep: Reputation: 31
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, 06:47 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
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



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 03:55 AM
ssh without password from user to root on same linux enterprise 5 machine linux2010 Linux - Newbie 3 01-24-2010 06:57 PM
user password not accepted when using SSH to a remote linux box emeak Linux - Newbie 2 08-06-2009 07:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:59 PM.

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
Open Source Consulting | Domain Registration