下一页 上一页 目录

4. 设置配置文件

我建议您首先安装文档中附带的已知良好的配置文件。

4.1 安装配置文件

将这些文件放置在它们的“标准”位置:在较新的 Linux 发行版上是 /etc/uucp,在较旧的发行版上是 /usr/lib/uucp

然后确保这些文件的 permissions

(guylhem@barberouge:uucp)$ ls -l
total 11
-rw-r--r--   1 uucp     uucp          501 Jan 23 11:33 Poll
-rw-r-----   1 uucp     uucp          589 Jan 23 11:34 call
-rw-r-----   1 uucp     uucp         1184 Jan 23 12:06 config
-rw-r-----   1 uucp     uucp          476 Jan 23 12:31 crontab
-rw-r-----   1 uucp     uucp         1256 Jan 23 11:47 dial
-rw-r-----   1 uucp     uucp          486 Jan 23 11:48 passwd
-rw-r-----   1 uucp     uucp          810 Jan 23 11:55 port
-rw-r--r--   1 uucp     uucp         1690 Jan 23 12:04 sys
(guylhem@barberouge:uucp)$

要更改文件所有者,以 root 用户身份,输入

(root@barberouge:uucp)$ chown uucp.uucp *

然后您必须更改文件权限;再次以 root 用户身份,输入

(root@barberouge:uucp)# chmod 640 *
(root@barberouge:uucp)# chmod +r Poll sys

4.2 “Poll” 文件

此文件用于设置任何系统的轮询时间表。

schedule polux 01
poll     polux 01

我的机器在 01:00 呼叫 polux,仅此而已!

如果您必须呼叫更多机器,您可以添加更多行,但不要忘记为每个机器添加 2 行(schedule 和 poll)。

4.3 “call” 文件

它包含您轮询的每个系统的登录名/密码

polux uudan password

我的机器在轮询 “polux” 时使用 “uudan” 登录名和 “password” 密码 :-)。

至于 Poll 文件,请根据您的情况进行调整。

4.4 “config” 文件

nodename barberouge                     # The UUCP name of this system

spool /var/spool/uucp                   # The UUCP spool directory
pubdir /var/spool/uucppublic            # The UUCP public directory
logfile /var/log/uucp/log               # The UUCP log file
statfile /var/log/uucp/stats            # The UUCP statistics file
debugfile /var/log/uucp/debug           # The UUCP debugging file

#sysfile        /etc/uucp/sys           # Default "sys"
#portfile       /etc/uucp/port          # Default "port"
#dialfile       /etc/uucp/dial          # Default "dial"
#dialcodefile   /etc/uucp/dialcode      # Default "dialcode"
#callfile       /etc/uucp/call          # Default "call"
#passwdfile     /etc/uucp/passwd        # Default "passwd"

# No commands may be executed by unknowns (empty list of permitted commands)
# Upload is authorized in /var/spool/uucp
unknown commands
unknown pubdir /var/spool/uucp
unknown remote-send ~ !~/upload
unknown remote-receive ~/upload

在这里,只需将 “barberouge” 替换为您自己的系统名称;如果您不记得了,请运行 “hostname”。

4.5 “crontab” 文件

# Every day just before morning generate reports.
#
0 7 * * *     /usr/lib/uucp/uudemon.day root
#
# Every hour start the uudemon.hr. To actually poll a remote system,
# enter its name in /etc/uucp/Poll. You are encouraged to change the "8".
#
8 * * * *      /usr/lib/uucp/uudemon.hr

只需运行 “crontab -u uucp /etc/uucp/crontab” 即可将其添加到其他 crontab 中。

4.6 “dial” 文件

# 1) expect nothing (i.e., continue with step 2)
# 2) send "ATZ", then a carriage return, then sleep for 1 to 2 seconds.
# The \c means to not send a final carriage return.
# 3) wait until the modem echoes "OK", then do the the same for "ATX4" & "OK"
# 4) send "ATDT", then the telephone number (after translating any dialcodes).
# 5) wait until the modem echoes "CONNECT"
# 6) if we get "BUSY", "NO CARRIER" ... during the chat script we abort dialing
# 7) when the call is over, we make sure we hangup the modem


dialer hayes
chat "" ATZ\r\d\c OK\r \dATX4\r\d\c OK\r ATDT\D CONNECT
chat-fail RING
chat-fail NO\sCARRIER
chat-fail ERROR
chat-fail NO\sDIALTONE
chat-fail BUSY
chat-fail NO\sANSWER
chat-fail VOICE
complete \d\d+++\d\dATH\r\c
abort \d\d+++\d\dATH\r\c

# You can also add other dialers: inetd, nullmodem ...
#dialer nullmodem
#complete \d\dexit\r\c
#abort \d\dexit\r\c

语法很复杂... 您最好不要在这里修改任何内容,除了 “ATZ” 和 “ATX4”,它们是我的调制解调器初始化字符串。

4.7 “passwd” 文件

#uuguest                guestpassword

如果您允许 uucp 拨入,只需在此文件中添加系统/密码。

就 *这么* 简单。

但出于安全原因,建议确保每个系统都有单独的帐户和主目录,以便您可以跟踪情况。

4.8 “port” 文件

# Description for the modem entry
# Debianers, make SURE this device is root:dialout, mode 0660 (crw-rw---)

port ACU
type modem
device /dev/ttyS0
dialer hayes
speed 57600
# hardflow n


# Description for the TCP port - pretty trivial. DON'T DELETE.
# Change service number if non standard, cf /etc/services

port TCP
type tcp
#service 540


# Description for the nullmodem entry
# (ttyS1 means COM2)

port nullmodem
type direct
device /dev/ttyS1
dialer nullmodem
speed 115200

您不应在此处更改任何内容... 除了您的调制解调器端口。

在带有 mgetty 的最新发行版上,它是 /dev/ttySN,而在较旧的发行版上,它是 /dev/cuaN,其中 N 是您的串行端口

N 从 0 开始,ttyS(N) 表示 COM(N+1),例如,我的零调制解调器在 ttyS1 (COM2) 上,而我的调制解调器在 ttyS0 (COM1) 上。

大多数最新调制解调器都支持硬件流控制,如果您的调制解调器不支持,只需取消注释行 “# hardflow n”。

4.9 “sys” 文件

# First some defaults. These are for ALL other entries (unless overridden).
#
protocol gvG
protocol-parameter G packet-size 1024
# protocol-parameter G window 7
protocol-parameter G short-packets

#
# Our remote uucp connection.
#
system polux
call-login *
call-password *
local-send /
local-receive /var/spool/uucppublic
remote-send /
remote-receive /var/spool/uucppublic
time any
phone 0111111110
port ACU
chat "" \r\c ogin:-BREAK-ogin:-BREAK- \L word: \P
#chat "" \d\d\r\c ogin: \d\L word: \P

# This is an alternate - it means that if a connection using the above
# "system polux" fails it falls through to this entry.
# Only useful if your service provider has more then one phone number for UUCP.
#
#alternate polux-2
#alias polux-2
#phone 0222222220

# Here's another alternate - we poll the system over TCP/IP.
# This is useful if we have a PPP connection to our provider.
# The first two entries will fail because the modem is busy & we will poll
# over TCP/IP.
#
#alternate polux-tcp
#alias polux-tcp
#time any
#address uucp.polux
#port TCP
#protocol t

#
# Last example - a system that we poll over TCP/IP.
#
#system horizon
#call-login *
#call-password *
#time any
#chat "" \d\d\r\c ogin: \d\L word: \P
#address uucp.horizon.nl
#port TCP
#protocol t

在这里,您必须将 “polux” 更改为您轮询的系统的名称,并将 “0111111110” 更改为其电话号码。

“polux-2”、“polux-tcp” 和 “horizon” 只是用户特定需求的示例;如果您轮询的系统有多条线路,请将其定义为 “itsname-2”;如果您有时通过 PPP 调用它,也请定义 “itsname-tcp”。

当 chat script 失败(忙碌...)时,这很有用。

4.10 现在让我们测试所有这些

首先运行

(root@barberouge:uucp)# su uucp
(uucp@barberouge:uucp)# /usr/lib/uucp/uuchk
Local node name barberouge
Spool directory /var/spool/uucp
Public directory /var/spool/uucppublic
Lock directory /var/lock
Log file /var/log/uucp/log
Statistics file /var/log/uucp/stats
Debug file /var/log/uucp/debug
Global debugging level
uucico -l will strip login names and passwords
uucico will strip UUCP protocol commands
Start uuxqt once per uucico invocation

System: polux
 When called using any login name
 Call out using port ACU
 The possible ports are:
  Port name ACU
   Port type modem
   Device /dev/ttyS0
   Speed 57600
   Carrier available
   Hardware flow control available
   Dialer hayes
    Chat script "" ATZ\r\d\c OK\r \dATX4\r\d\c OK\r ATDT\D CONNECT
    Chat script timeout 60
    Chat failure strings RING NO\sCARRIER ERROR NO\sDIALTONE BUSY NO\sANSWER VOICE
    Chat script incoming bytes stripped to seven bits
    Wait for dialtone ,
    Pause while dialing ,
    Carrier available
    Wait 60 seconds for carrier
    When complete chat script "" \d\d+++\d\dATH\r\c
    When complete chat script timeout 60
    When complete chat script incoming bytes stripped to seven bits
    When aborting chat script "" \d\d+++\d\dATH\r\c
    When aborting chat script timeout 60
    When aborting chat script incoming bytes stripped to seven bits
 Phone number 0111111110
 Chat script "" \r\c ogin:-BREAK-ogin:-BREAK- \L word: \P
 Chat script timeout 10
 Chat script incoming bytes stripped to seven bits
 Login name uudan
 Password your_password_here
 At any time may call if any work
 May retry the call up to 26 times
 May make local requests when calling
 May make local requests when called
 May send by local request: /
 May send by remote request: /
 May accept by local request: /var/spool/uucppublic
 May receive by remote request: /var/spool/uucppublic
 May execute /usr/bin/uucp /usr/bin/rmail /usr/bin/rnews
 Execution path /bin /usr/bin /usr/local/bin /usr/sbin
 Will leave 50000 bytes available
 Public directory is /var/spool/uucppublic
 Will use protocols gvG
 For protocol G will use the following parameters
  packet-size 1024
  short-packets

以检查您设置的所有信息是否正确。

警告:您的结果可能会有所不同;不同的发行版使用不同的路径,而 Linux FSSTD 无关!

如果一切正确,运行

        /usr/sbin/uucico -r 1 -x 9 -s remote_system_name

-x 9 将最大程度的调试信息写入 /var/log/uucp/debug 文件,以帮助进行初始设置。

我通常在这里运行 -x 4,因为该级别记录的详细信息可以帮助我解决登录问题。显然,此文本包含来自您的系统文件的明确信息(帐户/密码),因此请保护它免受世界读取。

4.11 附加信息

>来自 Pierre.Beyssac at emeraude.syseca.fr

Taylor 具有更多日志记录级别。使用 -x all 以获得尽可能高的级别。

此外,在调试时执行 "tail -f /var/log/uucp/debug" 以实时观察情况。


下一页 上一页 目录