LinuxQuestions.org
Help answer threads with 0 replies.
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 07-03-2003, 05:56 PM   #1
graffitici
Member
 
Registered: Jun 2003
Location: Istanbul - Turkey
Distribution: Fedora, Gentoo
Posts: 150

Rep: Reputation: 15
automounting??


Hi,

I would like to know whether it is possible to mount a drive when a specific user logs in. I am the root and i also have another user. When i try to mount a win partition with that user, i am told that only root can do that, and i find it boring to log in with the root, enter the password type all that mount command.
Is there a certain configuration file for each user that the shell loads everytime that user logs in?? Would it solve my problem if i added a couple of lines to that file??

Thanks for the help
 
Old 07-03-2003, 05:58 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
why do you need to mount it only on a certain login? why not just mount it on boot? just add "auto" to the options in /etc/fstab for the partition and it will load fine every boot.
 
Old 07-03-2003, 06:51 PM   #3
graffitici
Member
 
Registered: Jun 2003
Location: Istanbul - Turkey
Distribution: Fedora, Gentoo
Posts: 150

Original Poster
Rep: Reputation: 15
Well the reason is simple. I have a brother with whom i am supposed to share my computer. I don't let him use my windowses yet i created him an account on linux, thinking that it is secure enough even for him. As you see i want him to use the computer, but i don't want him to access my windows files. I guess if i add that entry intro fstab that will not be achieved.
Isn't there a way to do that??
 
Old 07-03-2003, 06:56 PM   #4
LogicG8
Member
 
Registered: Jun 2003
Location: Long Island, NY
Distribution: Gentoo Unstable (what a misnomer)
Posts: 380

Rep: Reputation: 30
If you do actually have a reason to have it mount
automatically only when a certain user logs in you
have a couple of options. You can:

A) Set up sudo to allow you to mount it

B) Add an entry in fstab with the noauto option
and that would allow any user to mount it via
mount /dev/<drive> /mnt/folder

For the automatic part you would add a little
line in the users .profile (or the startup script
for whatever shell the user has)

#Check if drive already mounted
cat /etc/mtab | grep /dev/<drive>
if [ $? -eq 1 ]; then
#sudo mount /dev/<drive> #Uncomment if using the sudo solution
mount /dev/<drive> /mnt/folder #comment ifusing sudo
fi

The sudo solution would keep it so only the user(s) you
choose and root could mount the drive but is a little more
work. Editing fstab is a bit easier but any user can then
mount the drive.

Last edited by LogicG8; 07-03-2003 at 06:58 PM.
 
Old 07-03-2003, 07:00 PM   #5
Obi Perrin
Member
 
Registered: Nov 2002
Posts: 136

Rep: Reputation: 15
Add 'user' to the options part of /etc/fstab for /mnt/win. Here's my line for example:

/dev/hda1 /mnt/windows vfat iocharset=iso8859-15,user,codepage=850,umask=0 0 0

This allows a normal user to mount a windows partition. You can make it more automatic though - after adding this option, enter the line "mount /dev/hda1" (assuming hda1 is your windows partition) in your users /home/user/.bashrc file.
 
Old 07-03-2003, 11:15 PM   #6
JayCnrs
Member
 
Registered: Mar 2003
Location: Winnipeg
Distribution: Suse 9.3 Pro
Posts: 404

Rep: Reputation: 30
Or you can put this in to your fstab:

/dev/hda2 /mnt/windows vfat umask=007,uid=(your_username),gid=(your_username) 0 0

This will make it so that your user and group is the only one with read/write access and nobody else can access /mnt/windows except of course root.

Good Luck
 
Old 07-04-2003, 04:58 AM   #7
graffitici
Member
 
Registered: Jun 2003
Location: Istanbul - Turkey
Distribution: Fedora, Gentoo
Posts: 150

Original Poster
Rep: Reputation: 15
ok so as LogicG8 said, i prefered editing fstab since it seemed to be easier. I added the lines:
/dev/hda2 /mnt/windows vfat umask=007,uid=(your_username),gid=(your_username) 0 0
as JayCnrs advised. Now when i normally login it is mounted. When i then login with the other user it magically unmounts the drive! And better yet it is impossible to mount it without the root password.
I guess the problem is solved now, Thank you all for your help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Automounting cybersaga Slackware 4 02-04-2005 12:53 AM
AutoMounting .???...............yes, Again :) hamoksh Linux - Newbie 7 08-15-2003 03:07 PM
AutoMounting dkc_ace Linux - Hardware 2 05-13-2003 02:57 PM
Automounting vector Linux - General 4 03-19-2003 06:00 PM
automounting cornelius Programming 3 07-05-2002 08:07 PM


All times are GMT -5. The time now is 11:10 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration