5

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:

  1. I've first already called: fusermount -u mount_location
  2. 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?)
  • Does your standard_sshfs_connection_string_or_script make use of absolute paths, or are you using relative ones? – tink Jul 29 '14 at 1:51
  • uses absolute paths :) – user2533809 Jul 29 '14 at 2:32
0

I haven't tried it, but perhaps I need to have the following line after the send command:

expect "$ "

to wait for the program to fully exit.

Another idea: perhaps when expect exits/closes, all of the child processes also terminate?

0

I'm not sure the output of sshfs is caught in expect. 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 output user@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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.