6

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?)
2
  • Does your standard_sshfs_connection_string_or_script make use of absolute paths, or are you using relative ones? Commented Jul 29, 2014 at 1:51
  • uses absolute paths :) Commented Jul 29, 2014 at 2:32

2 Answers 2

1

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.

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?

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.