LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 02-26-2006, 11:02 PM   #1
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Rep: Reputation: 56
About locking USB Flash Drive with password


Hi folks,

USB Flash Drive (Pen Drive)
Avixe Platinum Drive

Please advise how to add authenication on the drive so that other users can't mount it without password. I searched its manual on
http://www.avixe.com/support.asp

They have instruction for adding password for Windows. I can't find it for Linux.

TIA

B.R.
satimis
 
Old 02-27-2006, 05:26 AM   #2
Hammett
Senior Member
 
Registered: Aug 2003
Location: Barcelona, Catalunya
Distribution: Gentoo
Posts: 1,074

Rep: Reputation: 59
You must create a separate user that will be the only one allowed to mount the pendrive.
Then you must edit your /etc/fstab and configure the mount point and device. On options, add "uid=user" (without "users" option)

Whenever you want to mount the pendrive, you'll be needed to log into that specific user.
 
Old 02-27-2006, 05:44 AM   #3
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi Hammett,

Tks for your advice.

Suppose "satimis" is only allowed to mount the Flash Drive.

On /etc/fstab
Code:
.....
/dev/sda1 /mnt/sda1 vfat noauto,exec,umask=000,uid=satimis 0 0
Whether it should look as above.

The problem is when I'm away while the PC is still running, any user can mount the device. Would it be possible adding a password? After typing "mount /dev/sda1 /mnt/sda1" [ENTER]. It will popup for password.

TIA

satimis
 
Old 02-28-2006, 03:34 AM   #4
Hammett
Senior Member
 
Registered: Aug 2003
Location: Barcelona, Catalunya
Distribution: Gentoo
Posts: 1,074

Rep: Reputation: 59
AFAIK, linux does not work like this. Only with an X server you'll be able to have an emerging window where you'll be asked to provide user and password (and depending on which window manager you use). If you are connecting wth your PC via ssh, you'll need to log into satimis and then mount the pendrive.
Take out the "umask=000" option and only satimis should be able to mount it and read/write to it.
With the umask=000 option you're giving full permissions to everyone to access the drive (if I remember good).

Maybe it's possible to write a bash script that will enable the password thing you like to have (like making a regular su, provide password and then mount the drive) but this goes beyond my skills, as I'm not familiar with programming.

Hope it helps
 
Old 02-28-2006, 04:40 AM   #5
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi Hammett,

Tks for your advice.

Quote:
Take out the "umask=000" option and only satimis should be able to mount it and read/write to it.
With the umask=000 option you're giving full permissions to everyone to access the drive (if I remember good).
So the respective entry on /etc/fstab should look like
Code:
.....
/dev/sda1 /mnt/sda1 vfat noauto,exec,uid=satimis,rw 0 0
???

Can "root" mount the device?

Quote:
Maybe it's possible to write a bash script that will enable the password thing you like to have (like making a regular su, provide password and then mount the drive)
I have been thinking of it before. I'm now searching around for information how to start. This will be a simple bash script. I don't need GUI.

Others noted with tks.

B.R.
satimis

Last edited by satimis; 02-28-2006 at 04:43 AM.
 
Old 03-01-2006, 04:03 AM   #6
Hammett
Senior Member
 
Registered: Aug 2003
Location: Barcelona, Catalunya
Distribution: Gentoo
Posts: 1,074

Rep: Reputation: 59
Code:
/dev/sda1 /mnt/sda1 vfat noauto,exec,uid=satimis,rw 0 0
Exactely, this is how it should look your fstab.
Root user will be able to mount the pendrive as well. But if someone gets your root password, I think this will be the least important problem you'd have
 
Old 03-02-2006, 04:46 AM   #7
satimis
Senior Member
 
Registered: Apr 2003
Posts: 3,695

Original Poster
Rep: Reputation: 56
Hi Hammett,

Noted with tks.

satimis
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
USB Flash Drive awj78 Linux - Newbie 9 02-02-2006 11:14 AM
USB Flash Drive lyar1031 Linux - Newbie 1 01-30-2006 09:23 PM
USB Flash Drive TanSahara Mandriva 7 01-01-2006 11:06 PM
USB 2.0 Flash Drive fusee Linux - Hardware 3 04-16-2004 05:46 PM
USB Flash Drive Hady Linux - Hardware 1 11-20-2003 01:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 08:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration