When I run my SSHFS connection script from bash, everything works perfectly.
However, when I run the same script using the expect
utility, I get the following error when I try to access the folder mount location:
Transport endpoint is not connected
Here is my expect script:
#!/usr/bin/expect -f
spawn standard_sshfs_connection_string_or_script
expect "password: "
send "my_password\r"
Q: Any Ideas?
Note:
- I've first already called:
fusermount -u mount_location
- Is there something about
spawn
creating a new process, perhaps the sshfs process closes prematurely? (Is there any way to ensure the sshfs process stays open?)
Best Answer
I'm not sure the output of
sshfs
is caught inexpect
. This may be your problem - the script terminates without sending the password, which would cause the problem you describe.Another possible scenario is that
sshfs
is actually sending you the outputuser@domain password:
, and expect may not like it.However, this really isn't a good way of dealing with the problem. Your password is in plain text within that script!!
Have you considered using public-key authentication? Take a look at this git example if you don't know how it works.