How to use a USB Flash Key with out mounting and unmounting it!
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to use a USB Flash Key with out mounting and unmounting it!
Hello Everyone!
I wanted to figure out a way to where I could just plug in my USB Flash key into my Linux box and just access the device from KDE without having to mount or unmount it!
I did a little bit of research and eventually figured I it out!
I'm using Fedora Core 3 and KDE 3.3.*
I also have 'mtools' installed (very important!).
KDE 3.3 has integrated mtools with it self and can be used with typing in ' floppy:/ ' from konqueror (i'll explain later). Im not sure if you can access it the same way in Gnome, but you can definitely do it. You probably gotta do a little reasearch into mtools: ' man mtools '
This step-by-step howto is for KDE ( but can be applied to Gnome)
1) First you will need to find out what device your USB Flash disk is recognized as:
/dev/sda1
/dev/sdb1
/dev/sda2
/dev/sdb2
...etc
If you already know what device it is, skip to step 2.
I'm sure there is a more efficient way to do this, but what you could do to test which device it is recognized as is mount it. (lol! pretty ironic).
to find out:
a) plug it in
b) mount -t auto /dev/sda1 /mnt
or sdb1 or sda2 or sdb2 (which ever one works for you)
c) once it mounts, you'll know which device it is.
2) Now edit the file /etc/mtools.conf
add the following line under '# Linux Floppy Drives' :
drive u: file="/dev/sdb1" exclusive mformat_only
(change the sdb1 to whatever device yours is recognized as)
3) When you plug in your USB Key... it should appear in /dev/ as sda1 or sdb1 or whatever yours is... however the permission on it will only be 700 (only for root).
We'll need to change it so that when ever you plug it in, the permission should be 777.
Edit the file /etc/udev/permissions.d/50-udev.permissions
change the following line from :
sd*:root:disk:0660
to:
sd*:root:disk:0777
4) The Configuration is complete... Now we want to create a shortcut in KDE so that we can Access the USB KEY by only double-clicking the icon. ( there is no need to mount or unmount: for more info do a 'man mtools')
You can create this device anywhere...I chose my Desktop
i) Right mouse button your desktop
ii) Click 'Create New -> File -> Link to Location (URL)
iii) Under 'File name:' type 'USB Flash Device'
Under 'Enter link tolocation (URL):' type ' floppy:/u '
iv) Press OK and thats it!
You should now have an Icon on your desktop called ' USB Flash Device ' ( you can rename it).
Plug in your Usb Key and now double click your new icon! Voila! You should see the contents of your device!
Personally, I prefer the method of using automount/autofs. This way has the advantage that it doesn't depend on Konqueror or any other program. When you access the mount point, the device will be automatically mounted, and after you stop accessing it, it will be unmounted. It doesn't matter if you open the mount point in Konqueror or if you cd to it from the command line. Also, in addition to floppies and USB drives, it works with CD and DVD drives and network shares.
Another interesting tidbit I discovered is that you can write a script that works with Udev to automatically open the file manager when you insert a USB drive. Kind of makes having a desktop shortcut irrelevant (although they still come in handy).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.