How to get Drive letter and serial number of thumb drive in linux?
Hi All,
I am new to Linux ,i did one project in windows which will block the thumb drive with respect to serial number(Device instance ID) of the device.i am planning to do the same project in Linux using c/c++.I am very new to Linux,there is no drive letter for thumb drives we insert into Linux OS.How to get Drive letter and how to get Device instance id of thumb drives please help me get some clues.please provide me any tutorial or any links . Please let me know if have any other clues to block devices with respect "block list" and "allow device list".if the serial number in block list it has to block if serial number in allow device list it has to allow thumb drive to access. regards, manu |
Hello and Welcome to LinuxQuestions,
As you stated yourself: Quote:
Code:
man mount Code:
lspci Kind regards, Eric |
Details vary from Linux distro to distro. This is for Slackware 13.0.
Here's an excerpt from /var/log/messages after plugging in a thumb drive Code:
Feb 5 13:12:12 CW8 kernel: usb 1-8: new high speed USB device using ehci_hcd and address 4 |
You can use "/sbin/udevadm info --query=property --name /dev/<device>" to print information about a device.
If you know the node, also look at "ls /dev/disk/by-uuid/* -l" or "ls /dev/disk/by-path/* -l". These will be symbolic links to the actual devices and contain the path or uuid in their name. Using policy kit, you can disable the users ability to mount external drives all together. You could also have an /etc/fstab entry for mounting a particular usb drives filesystem with "uid=" and/or "dmask" options that will only give access to a particular user. This will only work on that computer. If the user can use "sudo" or "su", then all bets are off. For your own program, you would probably be working with policy kit to enforce your own policies. Here is an overview about how policy kit works. http://hal.freedesktop.org/docs/Poli...operation.html |
All times are GMT -5. The time now is 04:10 PM. |