📄 acucntrl.8
字号:
.\" Copyright (c) 1985, 1993.\" The Regents of the University of California. All rights reserved..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 3. All advertising materials mentioning features or use of this software.\" must display the following acknowledgement:.\" This product includes software developed by the University of.\" California, Berkeley and its contributors..\" 4. Neither the name of the University nor the names of its contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" @(#)acucntrl.8 8.2 (Berkeley) 12/11/93.\".TH ACUCNTRL 8 "December 11, 1993".UC 6.SH NAMEacucntrl \- turn around tty line between dialin and dialout.SH SYNOPSIS.B /usr/lib/uucp/acucntrlkeyword ttyline.SH DESCRIPTION.PP.I Acucntrlturns around the terminal line,enabling it to be used for both dialin and dialout.On dialin a terminal line is assumed to have modem control enabled and a gettyprocess in existence waiting for logins. On dialout modem control is disabledand there is no getty process..PPThis program must be run setuid to root..PP.I keywordis chosen from the list:.I disableor.IR dialout ,to condition a line for dialout;and.I enableor.IR dialin ,to condition a line for dialin..PPWhen the line is conditioned for dialing out, the login name of the real uidof the process is placed in /etc/utmp in capitals.This declares that the line is in use and acts as an additional lockingmechanism..I Acucntrlwill refuse to act if the /etc/utmp entry for the line is not null,is not the the user's login name (capitalized or not),and if the process is not running as the superuser.The last condition is to allow the superuser to clear the state of the line..PPTurning modem control on or off is handled by poking into /dev/kmem.It is currently implemented for dz, dh, and dmf lines..PPUnder 4.2 BSD the program will also refuse to disable a line if carrier issensed on it. This is to avoid the dead period where someone has just dialedin and made the connection but has not yet logged in..PP.I Ttylinecan be either of the form tty* or /dev/tty*.Enabling/disabling a line whose name does not begin with ttyd? is prohibitedunless the real uid of the process is 0 or if the login name corresponding tothe real uid is uucp. This is a security precaution..PP Steps taken when disabling.RI ( i . e .setup for dialing out).IP 1)check input arguments.IP 2)look in /etc/utmp to check that the line is not in use by another user.IP 3)disable modem control on line.IP 4)check for carrier on device.IP 5)change owner of device to real uid.IP 6)edit /etc/ttys, changing the first character of the appropriate line to 0.IP 7)send a hangup to process 1 to poke init to disable getty.IP 8)post uid name in capitals in /etc/utmp to let world know device has been grabbed.IP 9)make sure that DTR is on.PPSteps taken when enabling.RI ( i . e .setup for dialing in).IP 1)check input arguments.IP 2)look in /etc/utmp to check that the line is not in use by another user.IP 3)make sure modem control on line is disabled.IP 4)turn off DTR to make sure line is hung up.IP 5)condition line: clear exclusive use and set hangup on close modes.IP 6)turn on modem control.IP 7)edit /etc/ttys, changing the first character of the appropriate line to 1.IP 8)send a hangup to process 1 to poke init to enable getty.IP 9)clear uid name for /etc/utmp.SH HISTORY.PPFirst written by Allan Wilkes (fisher!allan).PPModified June 8,1983 by W.Sebok (astrovax!wls) to poke the kernel ratherthan use a kernel hack to turn on/off modem control, using a subroutinestolen from a program written by Tsutomu Shimomura {astrovax,escher}!tsutomu.PPWorked over many times by W.Sebok.RI ( i . e .hacked to death).SH FILES/dev/kmem, /vmunix, /etc/ttys, /etc/utmp, /dev/tty*.SH BUGS.PPSensing carrier requires the 4.2 BSD TIOCMGET ioctl call. Unfortunately thisioctl is not implemented in the vanilla 4.2 BSD dh driver even though thedz and dmf drivers use an emulation of the DH11's modem control bits. Thishas been fixed here..PPSome time (currently 2 seconds) is required between disabling modem controland opening the device. This is probably because of a race with getty whoseopen is finally being allowed to complete. This time interval may not beenough on a loaded system. Because of this problem and the above problem withthe dh driver there is deliberately no error message given when the TIOCMGETioctl fails..PPPreviously there were similar synchronization problems with the init process.When dialins are disabled the capitalized name of the process cannot be postedinto /etc/utmp until init has finished clearing /etc/utmp. However one doesnot know how long that will take, and, on a loaded system, it can take quitea while. This was solved by the strategy of 1) posting the name, 2) pokinginit, 3) going into a loop where the process repeatedly waits a second andchecks whether the entry has been cleared from /etc/utmp, and 4) posting thename again.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -