SSHFS questio
Hello,
I got a problem with using SSHFS. I write a script that mounts a remote server's folder to a local machine automatically using sshfs. Here is the script called sshfs-connect:
#!/usr/bin/expect -f
set password [lrange $argv 0 0]
set ipaddr [lrange $argv 1 1]
set username [lrange $argv 2 2]
set timeout -1
spawn -ignore HUP sudo /usr/local/bin/sshfs -o allow_other $username@$ip:/remote/path /local/path
match_max 100000
expect "*?assword:*"
send -- "$password\r"
send -- "\r"
expect eof
The scripts runs fine invoked using the command:
/home/ec2-user/init/sshfs-connect password ip username
However, when I try to invoke this from a Java program (which is started at boot time) in the following way:
Process p = new ProcessBuilder("/home/ec2-user/init/sshfs-connect","password", "ip", "username").start(),
it seems works. Since after the Java program executed, I check the /etc/mtab, it contains the following line:
username@ip:/remote/path /local/path fuse.sshfs rw,nosuid,nodev,max_read=65536,allow_other 0 0
But I can't access the mounted files. For example, using "ls", I got nothing. Also, once it's accessed(in any way), that line is removed from the file /etc/mtab.
Any idea? Many thanks!
Last edited by xiangzhang; 08-16-2011 at 03:58 AM.
|