Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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??
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??
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
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.
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.
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