Notes From Heck

Code Monkey Speaketh.

Mount a Drive on Linux

If you have a Box account and you want to access it from your linux system directly, follow these steps:

  • Install the WebDAV file system driver. On Arch Linux, this is done by running
$ sudo pacman -S davfs2
  • Set the username(email) and password for your Box account in the davfs2 secrets file. On Arch, add the following line to /etc/davfs2/secrets:
/mnt/box [email protected] secret_password_is_secret
  • Create the mount point where you want the Box files to be shown:
$ sudo mkdir /mnt/box
  • Add a line to your /etc/fstab to mount it automatically, with write access to a normal user: /mnt/box    davfs   defaults,uid=1000,gid=100   0 0

The uid and gid values must be the valid user id and primary group id of the regular user whose account needs access to the Box files. To find out the uid and gid for the currently logged in user, just run

$ id

Note: If you change the mount point in /etc/fstab from what is shown above, remember to change it in /etc/davfs2/secrets as well.

  • Disable the use_locks property in /etc/davfs2/davfs2.conf:
use_locks       0
  • Mount the folder by running:
$ sudo mount -a

This should automatically pick up the username and password from the davfs2 secrets file and mount the folder for you. If for some reason this doesn't work, try:

$ sudo mount.davfs /mnt/box

Once you have successfully mounted the folder using the mount -a command (which picks up mount options from /etc/fstab), try creating/modifying some files as the normal user (set above in step 4) to ensure everything is in order.

Author image
Bangalore, India
I’m a developer, a hobbyist biker, and a Linux enthusiast. When not riding into the sunset, and not being a general nuisance, I like to experiment with new systems and concepts in technology.