LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-22-2010, 04:12 PM   #1
1veedo
Member
 
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Rep: Reputation: 34
Bash: Input password into a variable


Hey I'm basically setting up two sshfs mounts and I have it set up so I run one command but type my password twice.

Is there an easy to way to input a password using bash and pass that variable to another process asking for a password?
 
Old 08-22-2010, 09:42 PM   #2
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
What are the commands you use to change the password?
 
Old 08-23-2010, 01:32 PM   #3
1veedo
Member
 
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Original Poster
Rep: Reputation: 34
Code:
sshfs user@ip:/XX /XX && sshfs user@ip:/XX /XX
Just thought it would be cool if I could put that in a bash script and have it ask for my password up front, piping it to those two commands or something.
 
Old 08-23-2010, 02:29 PM   #4
rgdacosta
Member
 
Registered: Jun 2007
Location: South Africa
Distribution: Linux Mint,Fedora, openSUSE, RHEL, SLES, Scientific Linux
Posts: 71

Rep: Reputation: 25
echo "password" | sshfs -o password_stdin user@ip:/share1 /mountpoint1 && echo "password" | sshfs -o password_stdin user@ip:/share2 /mountpoint2
 
1 members found this post helpful.
Old 08-23-2010, 05:11 PM   #5
1veedo
Member
 
Registered: Dec 2004
Location: WV, USA
Distribution: Gentoo, Debian
Posts: 186

Original Poster
Rep: Reputation: 34
Awesome I ended up doing this.
Code:
read -s -p "Password: " password
echo "$password" | sshfs -o password_stdin sshfs user@ip:/XX /XX && etc
 
Old 08-24-2010, 03:07 AM   #6
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
It might also be a good idea to ask the password twice for verification. You can see this example:
http://www.linuxquestions.org/questi...7/#post4061354
 
  


Reply

Tags
bash, sshfs



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash: How do I read data from a variable while that variable is being populated? theaceoffire Programming 4 04-23-2010 02:29 PM
combine bash & expect with variable from user input ndnd Linux - Newbie 2 09-17-2009 09:18 AM
Send password input via bash script lowlifeish Linux - Software 4 02-22-2007 12:40 PM
bash - how to take input as a variable? trees Linux - General 1 02-19-2004 04:09 PM
my mouse input is takes as keyboard input in BASH e1000 Slackware 5 12-08-2003 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:36 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
Open Source Consulting | Domain Registration