在树莓派上安装sshfs
sudo apt-get install sshfs
在树莓派上新建共享目录
mkdir ~/raspi-share
在Ubuntu上安装sshfs
sudo apt-get install sshfs
在Ubuntu上新建树莓派共享目录的挂载点
sudo mkdir /mnt/raspi-share
将树莓派的共享目录挂载至/mnt/raspi-share
sshfs pi@Raspberry_IP:/home/pi/raspi-share /mnt/raspi-share
更多内容请参考:How to mount a remote directory over ssh on Linux(LInux通过ssh挂载远程目录)
Suppose you would like to mount a remote directory locally. However, you only have ssh access to the host where the remote directory resides, and there is no network file system (e.g., NFS,Samba) available to export the directory with. In this case, you can actuallymount a remote directory over ssh, and access the directory via file system interfaces.
Mounting a remote folder over ssh is handled by FUSE kernel module, which allows one to create a virtual file system in user space.sshfs andgvfs are two such virtual file systems built on FUSE that allow one to mount a remote file system over ssh. In this post, I will show how to mount a remote directory over ssh withsshfs andgvfs.
Mount a remote directory over ssh with sshfs
To install sshfs on Ubuntu or Debian:
$ sudo apt-get install sshfs
To install sshfs on CentOS, RHEL or Fedora, first enable EPEL repository on your system, and then run the following.
$ sudo yum install sshfs
Next, if you want to use sshfs as a non-root user, you need to add the user to a group calledfuse. That is:
$ sudo usermod -a -G fuse <user_name>
Run the following to make group membership change activated.
$ exec su -l $USER
Finally, you can mount a remote directory using sshfs as follows.
$ sshfs my_user@remote_host:/path/to/directory <local_mount_point>
The above command will ask you for ssh password for the remote host. Once you enter the password, a remote directory will become available at the local mount point. If you want to set up passwordless mounting, all you have to do is toset up passwordless ssh login to my_user@remote_host.
To unmount a ssh-mounted directory:
$ fusermount -u <local_mount_point>
If you would like to automatically mount over ssh upon boot, set up passwordless ssh login, and append the following in /etc/fstab.
$ sudo vi /etc/fstab
sshfs#my_user@remote_host:/path/to/directory <local_mount_point> fuse user 0 0
Mount a remote directory over ssh on GNOME desktop
If you are using GNOME desktop, mounting over ssh is quite easy. Nautilus, the official file manager for GNOME desktop, already supports mounting over ssh. Underneath it, Nautilus usesgvfs virtual file system which can exposegvfs mounts over ssh using FUSE.
To mount a remote folder over ssh with Nautilus, go to "File"->"Connect to Server" on Nautilus. Then type in the remote ssh server information, remote folder path, as well as ssh login credentials as follows.
Once you click on "Connect" button, a local mount point will automatically be generated, and a remote directory will be mounted there viagvfs. To check agvfs mount point, run the following.
$ mount
gvfsd-fuse on /run/user/xmodulo/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,user=xmodulo)
$ ls /run/user/xmodulo/gvfs
sftp:host=remote_host.com,user=xmodulo
In this example, the local gvfs mount point is as follows. You can access a remote directory either via command-line at this mount point, or through Nautilus GUI.
/run/user/xmodulo/gvfs/sftp\:host\=remote_host.com\,user\=xmodulo/
如何在树莓派2B上安装FreeBSD:http://www.linuxdiyf.com/linux/16777.html
如何在装上Snappy Ubuntu的树莓派上启动WiFi:http://www.linuxdiyf.com/linux/15647.html
树莓派换源,从Ubuntu 15.04升级到Ubuntu 15.10“Wily:http://www.linuxdiyf.com/linux/15298.html
树莓派ubuntu mete 15.04台湾源:http://www.linuxdiyf.com/linux/14489.html
安装Ubuntu MATE 15.04 for 树莓派2:http://www.linuxdiyf.com/linux/12083.html