時刻同期/シャドウパスワード化

HS-DHGL

ファームウェア 1.10 とハックキット 2.0 がインストールできたので、 環境を整えていく。

次は時刻同期。録画サーバの時計が狂っていたのではしゃれにならない。

ntpd のインストール

sil:~# apt-get update
Get:1 http://security.debian.org etch/updates Release.gpg [189B]
Get:2 http://security.debian.org etch/updates Release [22.5kB]
	:
Hit http://ftp2.jp.debian.org etch/updates/non-free Sources
Hit http://ftp2.jp.debian.org proposed-updates/non-free
Fetched 348kB in 13s (25.3kB/s)
Reading package lists... Done
sil:~# apt-cache search ntp | grep ntp
cyrus-nntpd-2.2 - Cyrus mail system (NNTP support)
libnet-ntp-perl - Perl module to query NTP servers
libnews-nntpclient-perl - News::NNTPClient, Perl support for accessing NNTP servers
mountpy - script for quick mounting of removable devices
msntp - A very simple and portable SNTP client/server
nntp - An NNTP server for use with C News
ntp - Network Time Protocol daemon and utility programs
ntp-doc - Network Time Protocol documentation
ntp-refclock - transition package
ntp-simple - transition package
ntpdate - client for setting system time from NTP servers
openntpd - OpenBSD NTP daemon
phpgroupware-nntp - phpGroupWare newsgroup reader module
radioclk - simple ntp refclock daemon for MSF/WWVB/DCF77 time signals
libapache-mod-frontpage-mirfak - Frontpage support for apache
sil:~#
ntp パッケージをインストールすれば良さそう。
sil:~# apt-get install ntp
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
  perl perl-modules
Suggested packages:
  ntp-doc libterm-readline-gnu-perl libterm-readline-perl-perl
Recommended packages:
  perl-doc
The following NEW packages will be installed:
  ntp perl perl-modules
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 6064kB of archives.
After unpacking 24.9MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://ftp2.jp.debian.org etch/main perl-modules 5.8.8-7 [2310kB]
Get:2 http://ftp2.jp.debian.org etch/main perl 5.8.8-7 [3413kB]
Get:3 http://ftp2.jp.debian.org etch/main ntp 1:4.2.2.p4+dfsg-2 [342kB]
Fetched 6064kB in 7s (798kB/s)
Selecting previously deselected package perl-modules.
(Reading database ... 8810 files and directories currently installed.)
Unpacking perl-modules (from .../perl-modules_5.8.8-7_all.deb) ...
Selecting previously deselected package perl.
Unpacking perl (from .../archives/perl_5.8.8-7_arm.deb) ...
Selecting previously deselected package ntp.
Unpacking ntp (from .../ntp_1%3a4.2.2.p4+dfsg-2_arm.deb) ...
Setting up perl-modules (5.8.8-7) ...
Setting up perl (5.8.8-7) ...
chage: the shadow password file is not present
/usr/bin/chage failed with return code 15, shadow not enabled, password aging cannot be set. Continuing.
Starting NTP server: ntpd.

sil:~#

シャドウパスワード

the shadow password file is not present って???
sil:~# cat /etc/passwd
root:(暗号化されたパスワード):0:0:root:/root:/bin/bash
	:
yasunari:(暗号化されたパスワード):1001:1000:Yasunari Yamashita,,,:/home/yamasita/yasunari:/bin/bash
ntp:!:100:104::/home/ntp:/bin/false
sil:~#
あらら。シャドウパスワードになっていない。

変換する

sil:~# pwconv
sil:~# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
	:
yasunari:x:1001:1000:Yasunari Yamashita,,,:/home/yamasita/yasunari:/bin/bash
ntp:x:100:104::/home/ntp:/bin/false
sil:~#

どのサーバと同期?

sil:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 64-121-34-247.c 64.125.79.28     3 u   33   64    3  124.658    0.955   0.308
 gabe.kjsl.com   198.60.22.240    2 u   30   64    3  127.820  -15.499   0.276
 dosaku.ctipc.co 216.218.254.202  2 u   45   64    3  120.439   -4.740   1.287
 Time2.Stupi.SE  .PPS.            1 u    4   64    7  320.931  -42.213   3.418
sil:~#
しばらくして
sil:~# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-64-121-34-247.c 64.125.79.28     3 u   30   64   77  124.658    0.955   1.864
+gabe.kjsl.com   198.60.22.240    2 u   25   64   77  127.820  -15.499   0.462
+dosaku.ctipc.co 216.218.254.202  2 u   38   64   77  120.375   -4.098   2.255
*Time2.Stupi.SE  .PPS.            1 u   59   64   77  316.762  -40.240   5.140
sil:~#
同期した。

ntpd.conf の修正

国内のサーバと同期するよう修正する
sil:~# cd /etc
sil:/etc# mv ntp.conf ntp.conf.orig
sil:/etc# cp ntp.conf.orig ntp.conf
sil:/etc# ls -l ntp.conf*
-rw-r--r-- 1 root root 1582 Jul  6 23:44 ntp.conf
-rw-r--r-- 1 root root 1582 Mar  4 22:58 ntp.conf.orig
sil:/etc# vi ntp.conf
	:
	:
sil:/etc# diff -c ntp.conf.orig ntp.conf
*** ntp.conf.orig       Sun Mar  4 22:58:52 2007
--- ntp.conf    Fri Jul  6 23:46:38 2007
***************
*** 11,25 ****

  # You do need to talk to an NTP server or two (or three).
  #server ntp.your-provider.example

  # pool.ntp.org maps to more than 300 low-stratum NTP servers.
  # Your server will pick a different set every time it starts up.
  #  *** Please consider joining the pool! ***
  #  ***  ***
! server 0.debian.pool.ntp.org iburst
! server 1.debian.pool.ntp.org iburst
! server 2.debian.pool.ntp.org iburst
! server 3.debian.pool.ntp.org iburst

  # By default, exchange time with everybody, but don't allow configuration.
  # See /usr/share/doc/ntp-doc/html/accopt.html for details.
--- 11,29 ----

  # You do need to talk to an NTP server or two (or three).
  #server ntp.your-provider.example
+ server  ntp3.jst.mfeed.ad.jp
+ server  ntp2.jst.mfeed.ad.jp
+ server  ntp1.jst.mfeed.ad.jp
+ server  link.yamasita.jp

  # pool.ntp.org maps to more than 300 low-stratum NTP servers.
  # Your server will pick a different set every time it starts up.
  #  *** Please consider joining the pool! ***
  #  ***  ***
! #server 0.debian.pool.ntp.org iburst
! #server 1.debian.pool.ntp.org iburst
! #server 2.debian.pool.ntp.org iburst
! #server 3.debian.pool.ntp.org iburst

  # By default, exchange time with everybody, but don't allow configuration.
  # See /usr/share/doc/ntp-doc/html/accopt.html for details.
sil:/etc#
ntpd に設定を読込ませる
sil:/etc# /etc/init.d/ntp reload
sil:/etc# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
-64-121-34-247.c 208.201.242.2    3 u   40   64  377  125.606    1.722   1.215
+gabe.kjsl.com   198.60.22.240    2 u   35   64  377  127.551  -15.679   0.863
+dosaku.ctipc.co 216.218.254.202  2 u   46   64  377  120.375   -4.098   2.115
*Time2.Stupi.SE  .PPS.            1 u   61   64  377  313.991  -38.351   5.241
sil:/etc#
reload ではダメのよう。restart する
sil:/etc# /etc/init.d/ntp restart
Stopping NTP server: ntpd.
Starting NTP server: ntpd.
sil:/etc# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 ntp3.jst.mfeed. 210.173.160.56   2 u    1   64    1   11.589   -7.476   0.015
 ntp2.jst.mfeed. .INIT.          16 u    -   64    0    0.000    0.000   0.015
 ntp1.jst.mfeed. .INIT.          16 u    -   64    0    0.000    0.000   0.015
 link.yamasita.j .INIT.          16 u    -   64    0    0.000    0.000   0.015
sil:/etc#
しばらくして、同期した。
sil:/etc# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*ntp3.jst.mfeed. 210.173.160.56   2 u   57   64  377   11.410   94.391  97.586
+ntp2.jst.mfeed. 210.173.160.56   2 u   50   64  377   11.154   -7.658 130.848
+ntp1.jst.mfeed. 210.173.160.86   2 u   48   64  377   11.339   -7.612 130.780
xlink.yamasita.j 210.173.160.27   3 u   48   64  377    0.374  221.923 174.693
sil:/etc#



HS-DH320GL
楽天市場
Yahoo!ショッピング
somap.com
TSUKUMO ネットショップ
ValuMore!
ムラウチドットコム
アット・ニフティストア icon
Joshin web icon


ファンコントロール
ハックの記録
LinkStation/玄箱 をハックしよう

メールの設定

Copyright (C) 2003-2007 Yasunari Yamashita. All Rights Reserved.
yasunari @ yamasita.jp 山下康成@京都府向日市