Dev Notes

Various Cheat Sheets and Resources by David Egan/Carawebs.

Accessing Local Fileserver in Ubuntu


Backup, Linux, Sysadmin
David Egan

A headless always-on server can be a good way of managing office backups and shared directories.

These instructions assume that:

  • A linux server has been set up on the network and is accessible via SSH from the client machine (we use a raspberry pi with attached external storage)
  • The machines accessing the server’s filesystem are running Ubuntu desktop (14.04 in this case)
  • The remote filesystem (in this case, the external drive attached to the Pi) is mounted on /mnt - this is the directory that will be accessible by the client

Install sshfs on the Client Ubuntu Machine

SSHFS stands for SSH File System. It is a filesystem client that allows you to interact with files on a remote server or workstation by means of an SSH connection.

Install SSHFS:

sudo apt-get install sshfs

Add your non-sudo user to the fuse group:

sudo usermod -a -G fuse username

Activate group membership change:

exec su -l $USER

Make and Mount the Directory

test -e ~/local-backup-server || mkdir --mode 700 ~/local-backup-server
sshf pi@192.168.1.XXX:/mnt local-backup-server

You’ll need to enter password for the remote host.

You could also set up passwordless ssh login to simplify this process.

Unmounting the Filesystem

To unmount a ssh-mounted directory:

fusermount -u <local_mount_point>

Auto Mount

To automatically mount over ssh on boot:

  1. Set up passwordless ssh login
  2. Append the following in /etc/fstab:
sudo nano /etc/fstab
sshfs pi@192.168.1.123:/mnt <local_mount_point> fuse user 0 0

Connect Via Nautilus

In Nautilus, open ‘File’ > ‘Connect to Server’ in ‘Server Address’ bar, add sftp://pi@192.168.1.XXX:/mnt.

Resources


comments powered by Disqus