LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-16-2011, 03:56 AM   #1
xiangzhang
LQ Newbie
 
Registered: Aug 2011
Posts: 4

Rep: Reputation: Disabled
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.
 
Old 08-16-2011, 07:51 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
my first thought is that this just sounds mental. Why are you doing this?? wrapping stuff with expect can be the only way to acheive some things, but this is just to enter a password? why not just use ssh keys?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NetworkManagerDispatcher and sshfs mulebreath Linux - Newbie 1 09-22-2010 02:47 AM
sshfs tunnelling dair-targ Linux - Networking 5 03-28-2010 10:33 AM
sshfs vs. shfs airman99 Linux - Networking 3 07-18-2007 07:59 PM
SSHFS Drawbacks jerril Linux - Software 5 11-26-2006 05:21 PM
Linux home lan questio cerealdaemon Linux - Networking 6 05-12-2005 11:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration