You are not logged in.

#1 2012-08-24 21:40:49

PPeter
Member
Registered: 2012-08-21
Posts: 19

[SOLVED] Automount USB

I've trying to automount USB drives by the method suggested in Auto-mounting with udev.
When I insert a USB drive in, a terminal pops up that says "mounting ... to ...", and immediatly after it asks for my password. If I enter my password, the terminal will just disappear.

I tried to use the "ls" function with the directory path that the usb is mounted to, but it always shows nothing (both before and after I insert my password for the previously mentioned part).

So my question is:
Does the script actually work, or am I typing something in wrong?

Thanks for reading, and any replies are much appreciated.

Last edited by PPeter (2012-08-25 13:32:34)

Offline

#2 2012-08-24 22:19:32

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: [SOLVED] Automount USB

use udisks & a helper like devmon


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#3 2012-08-24 22:31:50

lilsirecho
Veteran
Registered: 2003-10-24
Posts: 5,000

Re: [SOLVED] Automount USB

Perhaps...light device mounter....ldm in the aur..... is what you would like.  It mounts all  partitions and usb devices thru media directory.


Prediction...This year will be a very odd year!
Hard work does not kill people but why risk it: Charlie Mccarthy
A man is not complete until he is married..then..he is finished.
When ALL is lost, what can be found? Even bytes get lonely for a little bit!     X-ray confirms Iam spineless!

Offline

#4 2012-08-25 04:26:21

PPeter
Member
Registered: 2012-08-21
Posts: 19

Re: [SOLVED] Automount USB

I'm using devmon to get it going and it's working pretty well now, so thanks for the suggestion. I'm also wondering about the deamon capabilities of it.

Being relatively new to deamons, I'm wondering if including just devmon in the rc.conf file would be enough to get it working. I read in the help file that even when it is run as a deamon, you have to add another command to it. So would I be able to write something like:

DEAMON= {... devmon --exec-on-drive /media ...}

?

Offline

#5 2012-08-25 04:43:33

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: [SOLVED] Automount USB

You don't put devmon into rc.conf. You put it into .xinitrc or what your DE/WM uses for startup items.

Offline

#6 2012-08-25 13:32:08

PPeter
Member
Registered: 2012-08-21
Posts: 19

Re: [SOLVED] Automount USB

Alright. Thanks for the help everyone, I got it working.

Offline

#7 2013-04-24 20:35:39

ravisghosh
Member
From: Intergalactic Spaces
Registered: 2006-10-12
Posts: 517
Website

Re: [SOLVED] Automount USB

I configured the Automount with Udev (https://wiki.archlinux.org/index.php/US … ge_Devices) from the wiki. However, when I insert any usb media, nothing happens. Any pointers?

Here is my domount file:

 #!/bin/sh

#edit the following variables to suit your needs
MYUID=1000              # your user uid
MYGID=100               # your user gid
MYLOGIN=shantanu        # your login
TERM=urxvt              # your terminal emulator
MYSHELL=bash            # your shell
export DISPLAY=:0       # your X display


TMPFILE=/run/automount.$RANDOM
DIR=`cat /etc/fstab | grep -v '#' | grep $* | awk '{print $2;}'`
if [ "x$DIR" = "x" ]; then
        MYUUID=`blkid -o value -s UUID $*`
        if [ "x$MYUUID" = "x" ]; then
                MYUUID="unknown"
        fi
        DIR=/run/media/$MYUUID
fi
mkdir -p /run/media
mkdir -p $DIR
cat > $TMPFILE << EOF
#!/bin/sh
echo "$* will be mounted on $DIR. "
sudo /bin/mount -o uid=$MYUID,gid=$MYGID $* $DIR
cd $DIR
$MYSHELL
cd
sudo /bin/umount $DIR
EOF
chmod a+x $TMPFILE
su $MYLOGIN -c "$TERM -t &#039;Terminal - $* mounted on $DIR&#039; -e $TMPFILE"
sleep 1; rm -f $TMPFILE 

Last edited by ravisghosh (2013-04-24 20:36:51)

Offline

#8 2013-04-24 20:56:02

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: [SOLVED] Automount USB

Ravi, do not necrobump old -- especially solved threads. You have been here longer than many. You should know the forum rules.


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

Board footer

Powered by FluxBB