LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   problem creating an alias to mount a drive (https://www.linuxquestions.org/questions/linux-newbie-8/problem-creating-an-alias-to-mount-a-drive-69404/)

j_l_ajaste 07-01-2003 06:47 PM

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:

Tinkster 07-01-2003 07:39 PM

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

DrOzz 07-01-2003 07:41 PM

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..

KDE4me 07-01-2003 07:41 PM

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

j_l_ajaste 07-01-2003 10:24 PM

Thanks to all!

j_l_ajaste 07-01-2003 10:28 PM

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.

Tinkster 07-01-2003 10:41 PM

If they disappear RH displays some ODD
behaviour ...

Cheers,
Tink


All times are GMT -5. The time now is 09:23 PM.