1826215 Members
2894 Online
109691 Solutions
New Discussion

mt_cd ???

 
Tarek
Super Advisor

mt_cd ???

Hi all,
a user asked me to install mt_cd command to some hpux workstation... i have never heard about it.. is it possible to install it?? i saw that there isn't any manual with this entry...
any tip??
Thanks in advance.
Tarek
16 REPLIES 16
Patrick Wallek
Honored Contributor

Re: mt_cd ???

That is not a valid HP-UX command. At least not that I know of.

Could they have an alias set up something like

alias mt_cd="mount /dev/dsk/c?t?d? /cdrom"
someone_4
Honored Contributor

Re: mt_cd ???

Hello,
But you cant mount a cd unless you have a user id of 0 wich is a superuser that is just as powerfull as root.
Wim Rombauts
Honored Contributor

Re: mt_cd ???

What is it that your user wants to do ?

If it is mounting a CD as the others suggest, you can configure the automounter to do that for you. The CD will be mounted when the user accesses the mountpoint and will be unmounted after a certain time of inactivity.
Tarek
Super Advisor

Re: mt_cd ???

I think that's it!!
Some users want to be able to mount and umount CD's whenever they want, so they don't have to call me each time to do that.
How can i configure this auomatically as suggested before with automounter??
Thanks
Tarek
Sanjay_6
Honored Contributor

Re: mt_cd ???

Hi tarek,

Create a file in /usr/bin with the mt_cd and have this entry in that file
mount -r /dev/dsk/c?t?d? /cdrom

Here c?t?d? is the device file name for the Cdrom as shown be "ioscan -fnC disk"

Change the permission of the file to 755. your users should now be able to use this command to mount the cdrom.

Hope this helps.

thanks

Tarek
Super Advisor

Re: mt_cd ???

Thanks Sanjay for your help, but unfortunately it isn't working. I created the file /usr/bin/mt_cd and i've set the permissions to 755, but while a user execute it, he will have this error:
mount: must be root to use mount
any further help?? Thanks very much.
Tarek
Ravi_8
Honored Contributor

Re: mt_cd ???

Hi, tarek
your user might have wanted a script to mount the cd instead of issuing command.
put the CD mounting command in a file and add in PATH.

never give up
Patrick Wallek
Honored Contributor

Re: mt_cd ???

You could also use sudo to do this.

Sudo allows non-root users to run commands, as set up by you, as root without knowing the root passwd.

You can get sudo here:
http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/sudo-1.6.2b1/

Once that is done, you could set up the mt_cd script as something like:

sudo mount /dev/dsk/c?t?d0 /cdrom

The script and users would then need to be set up in the /etc/sudoers file and then when the user enters mt_cd, they will be prompted for their password and the cd will be mounted.

You should probably also set up a umt_cd script with something like:

sudo umount /cdrom

so that the user can also unmount the cd when they are finished.
someone_4
Honored Contributor

Re: mt_cd ???

Hi
here is a link where that talks about the same probem that you are having now.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xca1d8ffa98a2d5118ff10090279cd0f9,00.html
Tarek
Super Advisor

Re: mt_cd ???

What kind of script?? the /usr/bin/mt_cd is a file that contains this command:
/usr/sbin/mount -r /dev/dsk/c1t2d0 /SD_CDROM and i've added it in the PATH, but i still have that error while i try to run it as a user.
Tarek
Super Advisor

Re: mt_cd ???

I've downloaded and installed sudo.
Then i created the file /usr/bin/mt_cd with this entry:
/opt/sudo/bin/sudo /usr/sbin/mount -r /dev/dsk/c1t2d0 /SD_CDROM
but how coud i configure the /etc/sudoers ??
if i do man sudo i have no entry, and also when i try to view /opt/sudo/man/man8/sudo.8 i have a not clear file..
so please help me again...
thanks.
someone_4
Honored Contributor
Edward Alfert_2
Respected Contributor

Re: mt_cd ???

to get man to work with any new applications you need to edit /etc/MANPATH and add the path to the man pages for your new application.

to be able to search man pages using man -k you need to recreate the index using catman -w
"Do what you love and you will never work a day in your life." - Confucius
Wim Rombauts
Honored Contributor

Re: mt_cd ???

If you want to give automounter a try :
- Add line "/- /etc/auto_direct" to file /etc/auto_master.
- Create file /etc/auto_direct and put the following line in this file : "/cdrom -ro,fstype=cdfs :/dev/dsk/c?t?d0"
"/cdrom" is the mountpoint that you wish to use. It SHOULD NOT already exist !

I forgot to say : You need HP-UX 11.0 (or higher) for this and configure the new automounter (autofs) in /etc/rc.coonfig.d/nfsconf (set AUTOFS=1). I don't know if this is possible with HP-UX 10.20

I know there is an issue about unmounting local devices with automounter, but that would be solved in the next NFS patch that is scheduled to be released this month (said HP support).

You can find more information in man automount (1M)
Wim Rombauts
Honored Contributor

Re: mt_cd ???

To avoid confusion because of a split line, the line in /etc/auto_direct is :
/cdrom -ro,fstype=cdfs :/dev/dsk/c?t?d0

And to activate it, you have to (re)start the automounter: kill the existing one and execute /usr/lib/netsvc/fs/autofs/automountd.
Wim Rombauts
Honored Contributor

Re: mt_cd ???

The patch needed to use automount for succesfully for local filesystems (CD's) is PHNE_24034.
Be sure to look at the dependencies !