Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
}

# LUKS-1TB
# /dev/sdb1
UUID='9dd6df52-c901-4b70-8151-27086ba7db16'
doMount

# Projects 1TB
# /dev/sdd1
UUID='6b01a30e-af6e-48b4-810a-f9824558f041'
doMount

# MyBook 1
# /dev/sdc2
UUID='b36a4a52-a73d-43b5-a96a-d92074b8ef3f'
doMount

# MyBook 2
# /dev/sdc3
UUID='c771609f-018e-45a4-b4f3-5eebc8e67c83'
doMount

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

share|improve this question

2 Answers 2

up vote 1 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 org.gnome.desktop.media-handling 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
1  
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

 
discard

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.