Dark Launch

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):

Code
echo mypassword | sshfs myuser@ftp.mysite.com:/ ~/mnt/mysite -o workaround=rename -o password_stdin

Replace mypassword, myuser, ftp.mysite.com and mysite.

Example:

Code
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:

Code
mkdir -p ~/mnt/example

Comments


  1. Many thanks, great solution

  2. BRILLIANT!  Thanks.

  3. 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

  4. regarding the timeout... do it first without the "echo $DESTINATION_PWD | "

    you may need to allow the connection the first time

  5. ... and without password_stdin

  6. probably why there's a timeout...

    user@user-linux:~$ ssh example.com
    The authenticity of host 'example.com (10.20.1.10)' can't be established.
    RSA key fingerprint is xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'example.com,10.20.1.10' (RSA) to the list of known hosts.

  7. Simple and perfect for webserver backup. Thank you!

  8. Thanks. This worked for me. Any security issues with this?

  9. @"security issues" the entry will be in your bash history if you type out the command

  10. Just remember to try the command manually first (or ssh to it) because it will fail waiting for the Y/N question ...

  11. Why won't this work in 'startup applications'?  works just fine in the terminal.

  12. look into using fstab to add mount to startup.

  13. thanks, you are genius!

  14. THX!

  15. Excellent... Mind blowing I would say.

  16. Finally after a rigorous search, I got the answer!!! Thank You soooo much...

  17. don't work :(
    "remote host has disconnected"

  18. 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.

  19. BINGO!

  20. thank you, bro!

  21. Very cool. Thanks.

  22. +1

  23. THIS IS AWESOME! 
    Not the most secure but gets the job done!

  24. How to stick that into fstab or get it working on startup?

  25. Here is some info on mounting partitions in Ubuntu

    https://help.ubuntu.com/community/Fstab

  26. I know how to mount most of the partitions, but fstab will not take echo command...

  27. 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.

  28. Hi,
    after struggling a couple of hours, I found your solution.
    Thanks, man!!!

  29. "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...

  30. goood