19.4. xinetd によるサービスの有効化

xinetd で管理しているサービスを有効化/無効化するには、chkconfig コマンドを使用します。chkconfig は、Turbolinux 10 Server の起動時にスタンドアローンモードで起動するサービスを設定するときにも使用するコマンドです。項7.2 もあわせて参照してください。

chkconfig コマンドに --list オプションを指定して実行すると、各サービスの起動設定を確認することができます。

# chkconfig --list
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
random          0:off   1:off   2:on    3:on    4:on    5:on    6:off
xinetd          0:off   1:off   2:off   3:on    4:on    5:on    6:off
murasaki        0:off   1:off   2:on    3:on    4:on    5:on    6:off
keytable        0:off   1:off   2:on    3:on    4:on    5:on    6:off
syslog          0:off   1:off   2:on    3:on    4:on    5:on    6:off
crond           0:off   1:off   2:on    3:on    4:on    5:on    6:off
kparam          0:off   1:off   2:off   3:on    4:off   5:on    6:off
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
xinetd based services:
        chargen-udp:    off
        chargen:        off
        daytime-udp:    off
        daytime:        off
        discard-udp:    off
        discard:        off
        echo-udp:       off
        cups-lpd:       off
        echo:   off
        krb5-telnet:    off
        netstat:        off
        systat: off
        amandaidx:      off
        swat:   off
        eklogin:        off
        gssftp: off
        klogin: off
        kshell: off
        amanda: off
        amidxtape:      off
        finger: off
        exec:   off
        login:  off
        shell:  off
        telnet: off
        tftp:   off
        time:   off
        time-udp:       off

このように、スタンドアローンモードで起動されるサービスを表示したあとに、xinetd で管理されているサービスの起動設定が表示されます。

例えば、telnet のサービスを有効化するには、以下のコマンドを実行します。

# chkconfig telnet on

このコマンドを実行すると、指定されたファイル名(この場合は、/etc/xinetd.d/telnet)の disable 属性を no に書き換えます。設定ファイルの詳細については、項19.5 で解説します。

service telnet
{
    disable     = no ← yes から no に書き換える
    socket_type = stream
    protocol    = tcp
    wait        = no
    user        = root
    server      = /usr/sbin/in.telnetd
    server_args = -h
}

これにより、telnet のサービスが有効になります。chkconfig --list コマンドで確認すると、telnet の起動設定が "on" に設定されたことを確認できます。

# chkconfig --list telnet
telnet          on

逆にサービスを提供しないのであれば、以下のコマンドを実行し、サービスを無効化します。

# chkconfig telnet off

xinetd の設定ファイルの内容を変更した場合は、変更を反映するために xinetd を再起動する必要があります。サービスを有効化するために chkconfig コマンドで設定ファイルの disable 属性を no に変更しただけではサービスは提供されません。以下のコマンドを実行し、xinetd を再起動します。

# /etc/init.d/xinetd restart

最後に、/etc/hosts.allow ファイルを編集し、サービスへのアクセスを許可するホストを指定します。

in.telnetd : 192.168.0.10

注意

Turbolinux 10 Server の xinetd は、TCP Wrappers を使用してクライアントからのアクセスを制御します。/etc/hosts.allow にアクセスを許可するホストを記述しなければ、クライアントは xinetd で提供したサービスを利用することはできません。