7

i'm trying to use sshfs on ubuntu. i have root access on the server i'm trying to connect to. but everytime i try to connect using my ubuntu laptop, the message i get is the following:

  cp@cp-AOA150:/$ sudo sshfs root@myserver:/ /home/cp/Documents/myserverfolder/
  read: Connection reset by peer
  cp@cp-AOA150:/$ 

i'm not too familiar with ubuntu / linux but could the problem be that the key that's on the server is not for the user "cp"?
If this is the case, how do i set up the root account on ubuntu?

any suggestions would be appreciated.

btw. i can ssh into the box no problems, but as root. so in other words, this works:

  ssh root@myservername

i've copied over my key file from work onto this new laptop. it's just sshfs that isn't happy right now. thanks.

EDIT 1

When I run sshfs with debug options like so:

  cp@cp-AOA150:~$ sshfs -o sshfs_debug -p 22 [email protected]:/ /home/cp/Documents/myserverfolder/

I get the following error message:

  SSHFS version 2.4
  fusermount: user has no write access to mountpoint /home/cp/Documents/myserverfolder/
  cp@cp-AOA150:~$ 

I've checked the permissions on the folder myserverfolder and it looks like this: (results of ls -la command)

   drwxr-xr-x 2 root root 4096 Mar 19 17:11 .
   drwxr-xr-x 4 cp   cp   4096 Mar 19 17:11 ..

Edit 2

I've ensured that the user cp is a part of the fuse group.

  cp@cp-AOA150:~$ sudo addgroup cp fuse
  [sudo] password for cp: 
  The user `cp' is already a member of `fuse'.
  cp@cp-AOA150:~$ 

Edit 3

Results of ls -ld

  cp@cp-AOA150:~$ ls -ld /home/cp/Documents/myserverfolder
  drwxr-xr-x 2 root root 4096 Mar 19 17:11 /home/cp/Documents/myserverfolder
  cp@cp-AOA150:~$ 

I'm not too familiar yet with linux but i did try to create a file in this folder using vim. I wasn't able to save the file... I think I created the folder using the "sudo " prefix to the mkdir command... because when i try without sudo, i get a "permission denied" error message. I'm going to google "chmod" to see how i can grant permissions to cp on this folder.

8
  • So you login with the key or with a password?
    – Meer Borg
    Mar 19, 2013 at 22:41
  • And if you run sshfs without sudo? Where did you put your key file? Mar 19, 2013 at 23:04
  • 1
    Can you really write to the mountpoint? Could you try it? What's the output of ls -ld /home/cp/Documents/cadev01 (or whatever mount point you're using now...)?
    – phoibos
    Mar 20, 2013 at 0:19
  • phoibos.. please check out edit 3
    – dot
    Mar 20, 2013 at 0:27
  • 1
    The mount point must be writeable by the user and empty. For the sake of testing, create a new mount point mkdir ~/mnttest and run sshfs -o sshfs_debug -p 22 [email protected]:/ ~/mnttest
    – phoibos
    Mar 20, 2013 at 1:10

2 Answers 2

6

Some ideas:

  • The root account on your local system doesn't have to do anything with the account you use on the remote system. Don't run sshfs with sudo! Besides, sshfs is a user space file system
  • Assuming you use ssh keys, did you copy your public key to the remote system? ssh-copy-id -i ~/.ssh/id_rsa.pub root@myserver
  • Maybe the port for ssh is different than the standard port 22? Use the -p option of sshfs
  • Use the debug option of sshfs: -o sshfs_debug
  • Is login with ssh as root on the server possible at all? Some distros disable this by default.
  • The user must be a member of the fuse group: sudo addgroup YOUR_USER fuse
  • The mount point must be writeble by the user and empty

Example:

mkdir ~/mnttest
sshfs -o sshfs_debug -p 22 root@myserver:/ ~/mnttest

Unmounting:

fusermount -u ~/mnttest
5
  • when i run that command, i get the following error message: SSHFS version 2.4 fusermount: user has no write access to mountpoint /home/cp/Documents/myserverfolder/ cp@cp-AOA150:~$
    – dot
    Mar 19, 2013 at 23:53
  • I've updated my post to make the error message clearer.
    – dot
    Mar 19, 2013 at 23:56
  • my user is already added. check out edit 2.
    – dot
    Mar 20, 2013 at 0:10
  • I had same problem. It turns out that in your case myserverfolder is not owned by your user cp.
    – pregmatch
    Jul 1, 2016 at 13:32
  • When I use the command ssh-copy-id -i ~/.ssh/id_rsa.pub root@myserver, I get /usr/bin/ssh-copy-id: ERROR: failed to open ID file '/home/casper/.ssh/id_rsa.pub': No such file. Why?
    – Casper
    Aug 11, 2016 at 13:52
1

In my case when sshfs did not work without a good error message, it turned out that "on the other side" there was a symbolic link pointing to another folder.

So sshfs user@myserver:/home/user/symboliclink does not work, but mounting to original folder does work, i.e. sshfs user@myserver:/opt/realfolder.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .