Ubuntu – trying to use sshfs on ubuntu

serversshsshfs

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 root@10.14.5.182:/ /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.

Best Answer

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