LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-01-2003, 06:47 PM   #1
j_l_ajaste
LQ Newbie
 
Registered: Jun 2003
Posts: 10

Rep: Reputation: 0
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
 
Old 07-01-2003, 07:39 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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
 
Old 07-01-2003, 07:41 PM   #3
DrOzz
Senior Member
 
Registered: May 2003
Location: Sydney, Nova Scotia, Canada
Distribution: slackware
Posts: 4,185

Rep: Reputation: 60
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..
 
Old 07-01-2003, 07:41 PM   #4
KDE4me
Member
 
Registered: Apr 2003
Location: Australia
Distribution: RedHat 9.0 / Slackware 9.0/ FreeBSD 4.8 / Solaris 8 x86 / Mandrake 9.0
Posts: 90

Rep: Reputation: 15
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
 
Old 07-01-2003, 10:24 PM   #5
j_l_ajaste
LQ Newbie
 
Registered: Jun 2003
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks to all!
 
Old 07-01-2003, 10:28 PM   #6
j_l_ajaste
LQ Newbie
 
Registered: Jun 2003
Posts: 10

Original Poster
Rep: Reputation: 0
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.
 
Old 07-01-2003, 10:41 PM   #7
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
If they disappear RH displays some ODD
behaviour ...

Cheers,
Tink
 
  


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
Need advice on creating an alias thorney Linux - General 2 11-27-2005 07:33 PM
Apache - creating an alias to access a cd-rom or DVD. verlossen Linux - Software 2 11-23-2005 06:14 AM
Lost pane,issues when creating alias from the bash shell spoult Linux - Software 2 04-19-2005 06:22 AM
Creating an alias (name=value pair) where the name has spaces. Cubert Linux - Newbie 2 01-12-2005 06:42 AM
Creating mult command alias in BASH labob Linux - Newbie 1 11-18-2004 07:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:03 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