EzDevInfo.com

sshfs interview questions

Top sshfs frequently asked interview questions

How do I specify the key file for sshfs?

I looked at the sshfs --help and there's nothing mentioning a key file. I have multiple pub/priv key pairs (for different servers) on my computer and I want to specify which key to use. How would I do this?

  usage: sshfs [user@]host:[dir] mountpoint [options]

  general options:
  -o opt,[opt...]        mount options
  -h   --help            print help
  -V   --version         print version

  SSHFS options:
  -p PORT                equivalent to '-o port=PORT'
  -C                     equivalent to '-o compression=yes'
  -F ssh_configfile      specifies alternative ssh configuration file
  -1                     equivalent to '-o ssh_protocol=1'
  -o reconnect           reconnect to server
  -o delay_connect       delay connection to server
  -o sshfs_sync          synchronous writes
  -o no_readahead        synchronous reads (no speculative readahead)
  -o sshfs_debug         print some debugging information
  -o cache=BOOL          enable caching {yes,no} (default: yes)
  -o cache_timeout=N     sets timeout for caches in seconds (default: 20)
  -o cache_X_timeout=N   sets timeout for {stat,dir,link} cache
  -o workaround=LIST     colon separated list of workarounds
      none             no workarounds enabled
      all              all workarounds enabled
      [no]rename       fix renaming to existing file (default: off)
      [no]nodelaysrv   set nodelay tcp flag in sshd (default: off)
      [no]truncate     fix truncate for old servers (default: off)
      [no]buflimit     fix buffer fillup bug in server (default: on)
  -o idmap=TYPE          user/group ID mapping, possible types are:
      none             no translation of the ID space (default)
      user             only translate UID of connecting user
  -o ssh_command=CMD     execute CMD instead of 'ssh'
  -o ssh_protocol=N      ssh protocol to use (default: 2)
  -o sftp_server=SERV    path to sftp server or subsystem (default: sftp)
  -o directport=PORT     directly connect to PORT bypassing ssh
  -o transform_symlinks  transform absolute symlinks to relative
  -o follow_symlinks     follow symlinks on the server
  -o no_check_root       don't check for existence of 'dir' on server
  -o password_stdin      read password from stdin (only for pam_mount!)
  -o SSHOPT=VAL          ssh options (see man ssh_config)

  FUSE options:
  -d   -o debug          enable debug output (implies -f)
  -f                     foreground operation
  -s                     disable multi-threaded operation

  -o allow_other         allow access to other users
  -o allow_root          allow access to root
  -o nonempty            allow mounts over non-empty file/dir
  -o default_permissions enable permission checking by kernel
  -o fsname=NAME         set filesystem name
  -o subtype=NAME        set filesystem type
  -o large_read          issue large read requests (2.4 only)
  -o max_read=N          set maximum size of read requests

  -o hard_remove         immediate removal (don't hide files)
  -o use_ino             let filesystem set inode numbers
  -o readdir_ino         try to fill in d_ino in readdir
  -o direct_io           use direct I/O
  -o kernel_cache        cache files in kernel
  -o [no]auto_cache      enable caching based on modification times (off)
  -o umask=M             set file permissions (octal)
  -o uid=N               set file owner
  -o gid=N               set file group
  -o entry_timeout=T     cache timeout for names (1.0s)
  -o negative_timeout=T  cache timeout for deleted names (0.0s)
  -o attr_timeout=T      cache timeout for attributes (1.0s)
  -o ac_attr_timeout=T   auto cache timeout for attributes (attr_timeout)
  -o intr                allow requests to be interrupted
  -o intr_signal=NUM     signal to send on interrupt (10)
  -o modules=M1[:M2...]  names of modules to push onto filesystem stack

  -o max_write=N         set maximum size of write requests
  -o max_readahead=N     set maximum readahead
  -o async_read          perform reads asynchronously (default)
  -o sync_read           perform reads synchronously
  -o atomic_o_trunc      enable atomic open+truncate support
  -o big_writes          enable larger than 4kB writes
  -o no_remote_lock      disable remote file locking

  Module options:

  [subdir]
  -o subdir=DIR           prepend this directory to all paths (mandatory)
  -o [no]rellinks         transform absolute symlinks to relative

  [iconv]
  -o from_code=CHARSET   original encoding of file names (default: UTF-8)
  -o to_code=CHARSET      new encoding of the file names (default: UTF-8)

Source: (StackOverflow)

How can I use sshfs to mount a remote drive (BeagleBone) on my Mac?

Why can't I connect to my BeagleBone using sshfs from my mac? I can ssh to this ip address just fine. Do I need to somehow create a special mount point? What does it mean that the socket is not connected?

sudo sshfs root@192.168.7.1: /Volumes/
remote host has disconnected
mount_osxfusefs: failed to mount /Volumes@/dev/osxfuse0: Socket is not connected

FYI I installed sshfs using brew cask sshfs


Source: (StackOverflow)

Advertisements

Unmount the directory which is mounted by sshfs in Mac

I've installed OSXFUSE in my mac and used sshfs to mount a remote directory. Now I would like to unmount it just but can't find the way. My OS is OSX 10.8 Mountain. Can anyone help?


Source: (StackOverflow)

GIT_DISCOVERY_ACROSS_FILESYSTEM problem when working with terminal and MacFusion

I'm using MacFusion with OSXFuse(similar to MacFuse) to mount my server over SSH onto my office machine. When I cd into my rails work directory on the server, i can't see any git info in my zsh prompt. If i try a git pull origin, i get the following error message:

fatal: Not a git repository (or any parent up to mount parent /Volumes)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)

I know I can ssh to the server but then wouldn't I lose zsh autocorrection & history? Wouldn't I also need to set up textmate and other software to use ssh? And wouldn't I need to remote desktop to install DMG's and so on? All of that seems like a bit of a hassle.

Is there a better way to do what I want to do? Otherwise is there a way to enable GIT_DISCOVERY_ACROSS_FILESYSTEM?

PS - MacFusion can also mount the server over FTP - would that be preferable to SSH?


Source: (StackOverflow)

Using git over sshfs is too slow

I'm using git over sshfs (under Mac OS X 10,5, 10.7) but it's too slow.

Everytime I logged in remote server direcly, to use git command.

I tried this post, http://kerneltrap.org/mailarchive/git/2008/10/23/3768494 however it doesn't work.

Does anyone know any good ideas?


Source: (StackOverflow)

Sublime Text 2 is sluggish during work over sshfs

I am using Sublime Text 2.0.1, and unfortunately making it work with files distributed over sshfs is a pain - switch to other tab and go back makes Sublime checking if file has not been changed.

Are there any Sublime preferences or maybe sshfs mount options which can make my work over remote resources possible?

For now I am using following sshfs option (faster encryption):

-o Ciphers=arcfour

Source: (StackOverflow)

Why can't I setup an SSHFS share? “OSXFUSE file system is not available” error

I'm trying to setup an SSHFS share from my local machine to a remote machine, but it is not working. I'm getting the error OSXFUSE file system is not available (see below). How to fix this??

FYI, my local machine is a MacBook Pro laptop running OSX 10.9.3. The remote machine is actually a VirtualBox on the same hardware running CentOS.

% brew install sshfs                                # <---- SSHFS is installed
Warning: sshfs-2.5.0 already installed

% brew install osxfuse                              # <---- OSX Fuse is installed
Warning: osxfuse-2.6.4 already installed

% ssh remote_user@XXX.XXX.XXX.XXX                   # <---- See, SSH works!!
Last login: Wed Jun 18 18:36:11 2014 from XXX.XXX.XXX.XXX
[remote_user@XXX.XXX.XXX.XXX ~]% exit

% sudo mkdir /mnt
% sudo mkdir /mnt/Share    
% sudo sshfs -o IdentityFile=~/.ssh/id_rsa.pub remote_user@XXX.XXX.XXX.XXX:/ /mnt/Share
the OSXFUSE file system is not available (-1)
the OSXFUSE file system is not available (1)

I tried solution described here. But it didn't work for me:

% sudo kextunload -b com.github.osxfuse.filesystems.osxfusefs
(kernel) Kext com.github.osxfuse.filesystems.osxfusefs not found for unload request.
Failed to unload com.github.osxfuse.filesystems.osxfusefs - (libkern/kext) not found.

Source: (StackOverflow)

How to mount a folder on amazon ec2 instance with private key using sshfs

I am trying to mount a folder on my amazon ec2 instance to my desktop folder using sshfs.

The problem is that I am not able to figure out how to give the option for private key (awskey.pem).

Normally I ssh using

ssh ec2-user@{amz-ip-address} -i {path to amzkey.pem}

But sshfs has no such options. However I saw a -F option and tried

sshfs ec2-user@{amz-ip-address}:{amz-folder}  {my mount dir} -F {path to amzkey.pem}

This gave me an error

"read: Connection reset by peer"

Please let me know if anyone has tried this before.


Source: (StackOverflow)

Why does directory vanish when I do SSHFS? How to setup SSHFS share on Max OSX 10.9?

I'm running Max OSX 10.9.3 and I'm trying to setup an SSHFS file-share between my MacBook Pro and a remote file system. However, when I try to do it, it doesn't work.

Strangely enough, it makes the target directory disappear. Has anyone else seen this happen? Is it a bug?

First see that I can ssh normally into the target machine:

% ssh remoteuser@XXX.XXX.XXX.XXX            # <--- SSH to remote system works! See below.
remoteuser@XXX.XXX.XXX.XXX % ls -altr remoteDir
total 8
drwxr-xr-x 26 remoteuser remoteuser 4096 Jun 22 01:00 ..
drwxrwxrwx  2 remoteuser remoteuser 4096 Jun 22 01:08 .
remoteuser@XXX.XXX.XXX.XXX % exit
%                                           # <--- Logged out of remote system

Next, I create a directory locally and verify it was created:

% pwd
/mnt

% ls
total 0
drwxr-xr-x  31 root  admin  1122 Jun 18 18:34 ../
drwxr-xr-x   2 root  admin    68 Jun 23 08:11 ./

% sudo mkdir share1 
% ls
drwxr-xr-x  31 root  admin  1122 Jun 18 18:34 ../
drwxr-xr-x   4 root  admin   136 Jun 23 08:50 ./
drwxr-xr-x   2 root  admin    68 Jun 23 08:50 share/

Now I try to setup the SSHFS share:

% sudo sshfs remoteuser@XXX.XXX.XXX.XXX:remoteDir /mnt/share1
remoteuser@XXX.XXX.XXX.XXX's password:
%

Ok. It seems to have worked. No errors. So let's see the share we created, shall we?

% ls
ls: share1: No such file or directory
total 0
drwxr-xr-x  31 root  admin  1122 Jun 18 18:34 ../
drwxr-xr-x   3 root  admin   102 Jun 23 08:12 ./

What? Not only is the File Sharing not working, but the share1 directory seems to have vanished! (Although the file system seems to know it is missing, which is weird).

Where did /mnt/share1 go and how do I setup this SSHFS?


Source: (StackOverflow)

Mounting a remote file system (sshfs) through an intermediate machine

The situation:

  • I am working from machine1, where I have root access. From machine1 I can access machine2 (where I am a user with no privileges) through ssh.
  • machine3 (also user with no privileges) is not directly accessible from machine1. I need to use an ssh connection from machine2 to access machine3.
  • In short: machine1 can ssh into machine2 but not into machine3. machine2 can ssh into machine3.

What I want to do:

  • I want to use sshfs to mount on machine1 a local (own) directory located on machine3.

Complications:

  • sshfs is not available on machine2.

How can this be done?


Source: (StackOverflow)

transmit vs macfusion (osx), a remote drive using Git

I am a developer and I needed to create a remote drive. At first time it was not problem because I would use Panic Transmit to mount the drive with SSH connection. And I could open, edit and save any file normally.

But this project is using Git (Version Control), so that I couldn't add/commit nothing into repository. If I try commit I get an Input/Output Error.

If I try connect to a server and commit directly there, I couldn't because I dont have credentials there. I need to commit it using my computer. So that I must have the remote drive.

I only get the right way using macfuse/macfusion. Anyone can give any explanation, or have any idea, about that ? Did I do something wrong in Transmit ?


Source: (StackOverflow)

After mounting using sshfs I cannot commit my changes using subversion

local machine:
Fedora 13 
Subversion: 1.6.9

remote machine:
CentSO 5.3
subversion 1.4.2

I have a project which is on the remote machine:

remote@x.x.x.x:projects/ssd1

I have mounted this on my local machine:

sshfs remote@x.x.x.x:projects/ssd1 /home/jbloggs/projects/mnt/ssd1

Everything mounts ok. So I open my project using GNU Emacs 23.2.1. When I want to comment my changes in emacs I get the following error:

can't move /home/jbloggs/projects/mnt/ssd1/.svn/tmp/entries to /home/jbloggs/mnt/ssd1/.svn/entries: Operation not permitted

Does anyone know of any way I can resolve this issue?

many thanks for any advice,


Source: (StackOverflow)

Mount a remote file system using SSHFS [closed]

Ok, the setup is a bit convoluted. Don't blame me, I'm not the sysadmin.

Here's the situation. There is one machine that I can SSH into from outside the network. I can only remote in as root (yes, you heard right) using my private key. I know that it is more typical to log in as a user and then elevate privileges, but in this case, I have to do the opposite.

The problem is that I want to use SSHFS in order to mount the file system remotely. I have this working perfectly. However, I don't want every file that I muck with to reflect root permissions. I would like to de-elevate first (su to a user account).

Anyone know how I can do this with SSHFS?


Source: (StackOverflow)

amazon ec2 ssh Permission denied (publickey) [closed]

I run into this trouble after I ran chown on the home folder of my ec2 instance, when I use sshfs to mount it on my local directory.
I make a mistake here. And after this, I could no longer login to it via ssh. Any way to fix this.

the logs are:

OpenSSH_6.0p1 Debian-3, OpenSSL 1.0.1c 10 May 2012
debug1: Reading configuration data /home/me/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ec2-54-219-20-60.us-west-1.compute.amazonaws.com [54.219.20.60] port 22.
debug1: Connection established.
debug1: identity file /home/me/ec2_key.pem type -1
debug1: identity file /home/me/ec2_key.pem-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 4e:13:41:26:f5:9e:10:6d:c5:a7:65:cb:21:3c:de:f8
debug1: Host 'ec2-54-219-20-60.us-west-1.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /home/me/.ssh/known_hosts:44
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /home/me/ec2_key.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey)


Source: (StackOverflow)

SSHFS through multiple connections

I have to occasionally work remotely. In order to do so, I have to connect to a gateway server, through which I can then connect to the development server. At work I can connect directly to the dev server. I use SSHFS to map the remote folder to a local one (in Ubuntu). My colleagues don't seem to mind using vim for all of their work, but I really prefer and IDE. I know that using just ssh I can tunnel through multiple connections (ssh -t server1 ssh -t server2), but I'd like to do the same with SSHFS. Does anyone know how this could be accomplished?


Source: (StackOverflow)