Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like to have my devices mounted in Nautilus/Nemo by default when I log in, so I can have symlinks to certain directories.

And I don't mean a custom mount or a mount with 10 lines of cryptSetup and luksOpen commands that would require me to hardcode a LUKS password. Not only because, but also because it is not compatible with the devices list in Nautilus/Nemo.

enter image description here

To do this, I can have an autostart script (Startup Applications) using gvfs-mount -d like so, very easy to maintain and it will automatically get LUKS-passwords from the keyring if necessary:

#!/usr/bin/env bash

# Redsandro 2013-03-01
# Mount (LUKS) drives and such

doMount() {
    # Devices change every now and then. UUID does not.
    DEV=`ls -l --color=never /dev/disk/by-uuid/ | grep $UUID | cut -d\>  -f2 | cut -d/ -f3`
    gvfs-mount -d /dev/$DEV

# /dev/sdb1

# Projects 1TB
# /dev/sdd1

# MyBook 1
# /dev/sdc2

# MyBook 2
# /dev/sdc3

However, this will open a window for every device. How can I prevent those windows from opening?

share|improve this question
up vote 2 down vote accepted

The answer is here (in another question) for Nautilus:

  • In GUI
    Install and/or run dconf-editor. Browse to org -> gnome -> desktop - media-handling.
    Uncheck automount-open.

  • In Terminal

    gsettings set automount-open false

There should be a similar option for Nemo since it is a fork of Nautilus.

Note that this will prevent Nautilus to open windows for any new mounted device (including USB keys).

There is no simple mean I'm aware of to selectively open windows for some devices and not for others (eg. there are means, but not simple; they require scripting and technical knowledge).

share|improve this answer
Thanks, this is the closest answer so far. I've edited your answer (pending peer review) to incorporate the two linked solutions, and accepted it. – Redsandro Mar 16 '13 at 0:24

This is wrong! You need to edit /etc/fstab. this is a sample :

/dev/sda1   /   ext2    defaults    1 1
/dev/sda2   /home/mostafa/musics    ext2    defaults    1 2

In the above, device /dev/sda2 is mounted to /home/mostafa/Musics

share|improve this answer
No, using fstab for this purpose is wrong. First, hotpluggable drives will cause mount-errors. Second, personal drives do not need to be hard-coded on a global scale (root in stead of user). Third, I would need to hard-code LUKS passwords. Fourth, this will remove the mounted hardware from the handy devices list. Sixth, gvfs-mount was developed specifically for this purpose. – Redsandro Mar 5 '13 at 10:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.