Operating System - HP-UX
1834665 Members
2534 Online
110069 Solutions
New Discussion

Disable modem when not in use

 
Edmund_2
Advisor

Disable modem when not in use

Hi all,
Our server has a modem installed for dial-in support purpose. Is there any cmd to disable it (like disable a printer/queue)? I can call my staff to login any terminal to enable it when I need to dial in.

I can't turn it off as it is placed in a locked room.

Any suggestion is appreciated.

Thanks
Edmund
11 REPLIES 11
Paula J Frazer-Campbell
Honored Contributor

Re: Disable modem when not in use

Hi
An option is the delete and recreate the device file as and when needed.

Write a small script to do it.

Just an idea.

Paula
If you can spell SysAdmin then you is one - anon
Alexander M. Ermes
Honored Contributor

Re: Disable modem when not in use

Hi there.
Disable dialin :
edit /etc/inittab, remark the respawn of the getty for the modem. After that run an init q and kill the getty process. To avoid dialing out restrict the rights for the cu utility.
Rgds
Alexander M. Ermes
.. and all these memories are going to vanish like tears in the rain! final words from Rutger Hauer in "Blade Runner"
Krishna Prasad
Trusted Contributor

Re: Disable modem when not in use

You can also write a scipt that will put the .lock file in /usr/spool/uucp that will show the modem in use. Then a script to remove it when you need support.
Positive Results requires Positive Thinking
harry d brown jr
Honored Contributor

Re: Disable modem when not in use

Sure, we used to have a script that would change the baud rate on the tty to some unuseable setting (closemodem), then another script that set it correctly (openmodem). Also, because modems pose such a security risk, think about getting a dial-back modem, one where you authenicate, then it hangs up and dials you back!

live free or die
harry
Live Free or Die
Sanjay_6
Honored Contributor

Re: Disable modem when not in use

Hi,

How is your dial-in modem used. If there is a getty running on the port to which the modem is connected you can diable it by setting the entry "respawn" to "off" in the /etc/inittab file for that port and then doing a "init q". Chanege "off" to "respawn" if you want to enable the getty on the port and then do "init q".

If you can do all this, why don't you ask them to turn the modem off and just call in and ask them to turn it on. Will save a lot of headache.

Hope this helps.

Regds
Edmund_2
Advisor

Re: Disable modem when not in use

Hi all,
Thx for your reply.
Can I have a sample of the scripts you mentioned?
Is it like this?
# disable
touch .lock /usr/spool/uucp

# enable
rm /usr/spool/uucp/.lock

Edmund
Scott Van Kalken
Esteemed Contributor

Re: Disable modem when not in use

A cool way is to use the suggestions above (i.e. inittab) but use different run levels.

Eg: dialin:4:reswpan /dev/modem
nodial:5:

whatever....

then it's a simple matter of changing run levels to be able to dial in or not dial in.

I used to do this years ago on a BSD box to make the modem either dial in or dial out.

init 5 was dial out
init 6 was dial in.

just my 2 cents worth
Edmund_2
Advisor

Re: Disable modem when not in use

Hi all,

In vi, I can use "g/ttyd2a2/s/respawn/off" to modify the line. How can I do this with sed?
"sed '' inittab" doesn't work.

Thx.

Edmund
Steven Sim Kok Leong
Honored Contributor

Re: Disable modem when not in use

Hi,

Use sed -e for regular expressions ie.
sed -e 's//
Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
Edmund_2
Advisor

Re: Disable modem when not in use

Hi Steven,

Thx. But there are many 'respawn' in inittab and I just want to replace the one in ttyd2a2 line. (ie find text1, replace text2 with text3)

Any suggestion

Edmund
Steven Sim Kok Leong
Honored Contributor

Re: Disable modem when not in use

Hi,

Not so sure that there is any search function included in sed.

One way is to include the search pattern in the replacing and replacement string eg.:

$ sed 's/ttyd2a2:234:respawn/ttyd2a2:234:off/' inittab

One easy way is to include use of grep:

grep -v ttyd2a2 inittab > inittab.new;grep ttyd2a2 inittab|sed 's/respawn/off/g' >> inittab.new;mv inittab.new inittab

I think awk would be better tool in such cases.

Hope this helps. Regards.

Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com