How to remote mount with password using SSHFS and stdin; Ubuntu sshfs remote mounting; MOSSO
This will allow you to mount a remote ssh filesystem using sshfs (Secure SHell FileSystem):
echo mypassword | sshfs myuser@ftp.mysite.com:/ ~/mnt/mysite -o workaround=rename -o password_stdin
Replace mypassword, myuser, ftp.mysite.com, and mysite.
Example:
echo 4ghNZGpk182q8SvY0kw021JbRb34THaPDN8wyXY679BQPSit5A | sshfs jsmith@ftp.example.com:/ ~/mnt/example -o workaround=rename -o password_stdin
NOTE: Make sure the mount folder ~/mnt/example
exists or create it:
mkdir -p ~/mnt/example
34 comments
Many thanks, great solution
BRILLIANT! Thanks.
I'm running this script and keep getting
"Timeout waiting for prompt"
. Any suggestions:echo $DESTINATION_PWD | sshfs -o workaround=rename,password_stdin,sshfs_debug $DESTINATION_USER@$DESTINATION_SERVER:$DESTINATION_SERVER_PATH $MOUNT_PATH
regarding the timeout... do it first without the
"echo $DESTINATION_PWD | "
you may need to allow the connection the first time
... and without
password_stdin
Simple and perfect for webserver backup. Thank you!
Thanks. This worked for me. Any security issues with this?
@"security issues" the entry will be in your bash history if you type out the command
Just remember to try the command manually first (or ssh to it) because it will fail waiting for the Y/N question ...
Why won't this work in 'startup applications'? works just fine in the terminal.
look into using fstab to add mount to startup.
thanks, you are genius!
THX!
Excellent... Mind blowing I would say.
Finally after a rigorous search, I got the answer!!! Thank You soooo much...
don't work :(
"remote host has disconnected"
This is why I'm here ;-)
"Just remember to try the command manually first (or ssh to it) because it will fail waiting for the Y/N question ..."
Oops.
BINGO!
thank you, bro!
Very cool. Thanks.
+1
THIS IS AWESOME!
Not the most secure but gets the job done!
You're genius! Thank you very much! Greetings from Italy, fabriziorubino.it
I get the error
"Timeout waiting for prompt"
. I have previously ssh to the server so it's not the y/n prompt. Trying to do this with Cloud9 to a DigitalOcean server. Any ideas?How to stick that into fstab or get it working on startup?
Here is some info on mounting partitions in Ubuntu
https://help.ubuntu.com/community/Fstab
I know how to mount most of the partitions, but fstab will not take echo command...
I put this in a bash script and it works without getting the password prompt. But when the same script run from Jenkins I keep on getting the same message:
"Timeout waiting for prompt"
, so the Jenkins job just failed. Wonder if anybody observed this and could offer a solution or workaround? Thanks much.Hi,
after struggling a couple of hours, I found your solution.
Thanks, man!!!
"Timeout waiting for prompt"
happens due to host identity verification while connecting for the very first time. Simply add-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
. The first option allows you to connect to unknown hosts without prompt, the second option prevents the host key from getting stored in the first place, so you won't run into problems if it changes. This is not very secure, but neither is piping the clear-text password...You're a hero, thanks!
goood
Nov 2, 2016, you're the best :)
Thank you man, you're save me
:)
Leave a Reply