problem creating an alias to mount a drive
I am running RH 8.0. Am trying to create a simple alias to allow me to mount my usb floppy drive (which is normally mountable, when I'm logged on as root, via "mount -t auto /dev/sda /mnt/usb/"). So I put an alias line in .bashrc as follows:
alias mountusb='mount -t auto /dev/sda /mnt/usb/'. Once I log back on and type "mountusb" I get "Only root can do that." So when I log on as root and type in "mountusb" I get "command not found." How can I correct this? Thanks. Jared the :newbie: |
It's less of an alias than an administrative
problem ... What you want to do is to edit /etc/fstab and add something like /dev/sda /mnt/usb noauto user,rw 0 0 After that you can add a line like your alias to both roots and your normal users .bashrc :} Cheers, Tink |
and just to explain your problem, you are adding that alias to your normal users .bashrc, the root has this same file in the home (/root) directory also....so the reason why it said command not found is because what you added to your normal users .bashrc wasn't added to you roots .bashrc..
|
Well yeah you could make an alias but then you would need to create an Sbit for the alias that root has created. i.e. chmod 4555 /bin/mount and make sure that the alias is in everyone's path. What would make more sense would be to edit the /etc/fstab:
/dev/sda mountpoint auto defaults,noauto,owner 0 0 then when you want to mount the drive: $mount mountpoint On another note, I believe that mount available to users if it is available in the fstab or they have permissions to the mount command. It sounds like your getting command not found because you edited in /root/.bashrc instead of /home/user/.bashrc You could resolve this by editing the /etc/skel/.bashrc and creating the new accounts |
Thanks to all!
|
Tinkster and KDE4me, if I edit fstab, will my changes still be **in** that file after I reboot the machine, or will I need to modify fstab each time I log on? I have modified fstab in other ways recently and it seems to me that my changes disappeared upon rebooting.
|
If they disappear RH displays some ODD
behaviour ... Cheers, Tink |
All times are GMT -5. The time now is 09:23 PM. |