May 29, 2009
[Linux] rkhunter を試してみた。
rkhunter は rootkit を検出してくれるツール。 chkrootkit に引き続きこちらも試してみた。 rkhunter の方がより詳細な情報を出してくれて楽しい。
- The Rootkit Hunter project
- http://rkhunter.sourceforge.net/
rkhunter のインストール
Debian Etch に rkhunter 1.2.9 をインストールした。 apt でインストール出来るので非常に楽。
# apt-get install rkhunter Reading package lists... Done Building dependency tree... Done Recommended packages: libmd5-perl The following NEW packages will be installed: rkhunter (SNIP) Unpacking rkhunter (from .../rkhunter_1.2.9-2_all.deb) ... Setting up rkhunter (1.2.9-2) ... # rkhunter --version Rootkit Hunter 1.2.9 #
rkhunter の実行
# rkhunter -c
Rootkit Hunter 1.2.9 is running
Determining OS... Unknown
Warning: This operating system is not fully supported!
All MD5 checks will be skipped!
Checking binaries
* Selftests
Strings (command) [ OK ]
* System tools
Skipped!
Check rootkits
* Default files and directories
Rootkit '55808 Trojan - Variant A'... [ OK ]
ADM Worm... [ OK ]
Rootkit 'AjaKit'... [ OK ]
Rootkit 'aPa Kit'... [ OK ]
Rootkit 'Apache Worm'... [ OK ]
Rootkit 'Ambient (ark) Rootkit'... [ OK ]
Rootkit 'Balaur Rootkit'... [ OK ]
Rootkit 'BeastKit'... [ OK ]
Rootkit 'beX2'... [ OK ]
Rootkit 'BOBKit'... [ OK ]
Rootkit 'CiNIK Worm (Slapper.B variant)'... [ OK ]
Rootkit 'Danny-Boy's Abuse Kit'... [ OK ]
Rootkit 'Devil RootKit'... [ OK ]
Rootkit 'Dica'... [ OK ]
Rootkit 'Dreams Rootkit'... [ OK ]
Rootkit 'Duarawkz'... [ OK ]
Rootkit 'Flea Linux Rootkit'... [ OK ]
Rootkit 'FreeBSD Rootkit'... [ OK ]
Rootkit 'Fuck`it Rootkit'... [ OK ]
Rootkit 'GasKit'... [ OK ]
Rootkit 'Heroin LKM'... [ OK ]
Rootkit 'HjC Kit'... [ OK ]
Rootkit 'ignoKit'... [ OK ]
Rootkit 'ImperalsS-FBRK'... [ OK ]
Rootkit 'Irix Rootkit'... [ OK ]
Rootkit 'Kitko'... [ OK ]
Rootkit 'Knark'... [ OK ]
Rootkit 'Li0n Worm'... [ OK ]
Rootkit 'Lockit / LJK2'... [ OK ]
Rootkit 'MRK'... [ OK ]
Rootkit 'Ni0 Rootkit'... [ OK ]
Rootkit 'RootKit for SunOS / NSDAP'... [ OK ]
Rootkit 'Optic Kit (Tux)'... [ OK ]
Rootkit 'Oz Rootkit'... [ OK ]
Rootkit 'Portacelo'... [ OK ]
Rootkit 'R3dstorm Toolkit'... [ OK ]
Rootkit 'RH-Sharpe's rootkit'... [ OK ]
Rootkit 'RSHA's rootkit'... [ OK ]
Sebek LKM... [ OK ]
Rootkit 'Scalper Worm'... [ OK ]
Rootkit 'Shutdown'... [ OK ]
Rootkit 'SHV4'... [ OK ]
Rootkit 'SHV5'... [ OK ]
Rootkit 'Sin Rootkit'... [ OK ]
Rootkit 'Slapper'... [ OK ]
Rootkit 'Sneakin Rootkit'... [ OK ]
Rootkit 'Suckit Rootkit'... [ OK ]
Rootkit 'SunOS Rootkit'... [ OK ]
Rootkit 'Superkit'... [ OK ]
Rootkit 'TBD (Telnet BackDoor)'... [ OK ]
Rootkit 'TeLeKiT'... [ OK ]
Rootkit 'T0rn Rootkit'... [ OK ]
Rootkit 'Trojanit Kit'... [ OK ]
Rootkit 'Tuxtendo'... [ OK ]
Rootkit 'URK'... [ OK ]
Rootkit 'VcKit'... [ OK ]
Rootkit 'Volc Rootkit'... [ OK ]
Rootkit 'X-Org SunOS Rootkit'... [ OK ]
Rootkit 'zaRwT.KiT Rootkit'... [ OK ]
* Suspicious files and malware
Scanning for known rootkit strings [ OK ]
Scanning for known rootkit files [ OK ]
Testing running processes... [ Skipped ]
Miscellaneous Login backdoors [ OK ]
Miscellaneous directories [ OK ]
Software related files [ OK ]
Sniffer logs [ OK ]
[Press to continue]
* Trojan specific characteristics
shv4
Checking /etc/rc.d/rc.sysinit [ Not found ]
Checking /etc/inetd.conf [ Clean ]
Checking /etc/xinetd.conf [ Skipped ]
* Suspicious file properties
chmod properties
Checking /bin/ps [ Clean ]
Checking /bin/ls [ Clean ]
Checking /usr/bin/w [ Clean ]
Checking /usr/bin/who [ Clean ]
Checking /bin/netstat [ Clean ]
Checking /bin/login [ Clean ]
Script replacements
Checking /bin/ps [ Clean ]
Checking /bin/ls [ Clean ]
Checking /usr/bin/w [ Clean ]
Checking /usr/bin/who [ Clean ]
Checking /bin/netstat [ Clean ]
Checking /bin/login [ Clean ]
* OS dependant tests
Linux
Checking loaded kernel modules... [ OK ]
Checking file attributes [ OK ]
Checking LKM module path [ OK ]
Networking
* Check: frequently used backdoors
Port 2001: Scalper Rootkit [ OK ]
Port 2006: CB Rootkit [ OK ]
Port 2128: MRK [ OK ]
Port 14856: Optic Kit (Tux) [ OK ]
Port 47107: T0rn Rootkit [ OK ]
Port 60922: zaRwT.KiT [ OK ]
* Interfaces
Scanning for promiscuous interfaces... [ OK ]
[Press to continue]
System checks
* Allround tests
Checking hostname... Found. Hostname is Ouverture
Checking for passwordless user accounts... OK
Checking for differences in user accounts... [ NA ]
Checking for differences in user groups... Creating file It seems this is your first time.
Checking boot.local/rc.local file...
- /etc/rc.local [ OK ]
- /etc/rc.d/rc.local [ Not found ]
- /usr/local/etc/rc.local [ Not found ]
- /usr/local/etc/rc.d/rc.local [ Not found ]
- /etc/conf.d/local.start [ Not found ]
- /etc/init.d/boot.local [ Not found ]
Checking rc.d files... [ Not found ]
Checking history files
Bourne Shell [ OK ]
* Filesystem checks
Checking /dev for suspicious files... [ OK ]
Scanning for hidden files... [ Warning! ]
---------------
/etc/.java
/etc/.pwd.lock /dev/.static
/dev/.udev
/dev/.initramfs
/dev/.initramfs-tools
---------------
Please inspect: /etc/.java (directory) /dev/.static (directory) /dev/.udev (directory) /dev/.initramfs (directory)
[Press to continue]
Application advisories
* Application scan
Checking Apache2 modules ... [ OK ]
Checking Apache configuration ... [ OK ]
* Application version scan
- Exim MTA 4.63 [ Unknown ]
- GnuPG 1.4.6 [ Unknown ]
- Bind DNS 9.3.4-P1.1 [ Unknown ]
- OpenSSL 0.9.8c [ Unknown ]
- OpenSSH 4.3p2 [ Unknown ]
Your system contains some unknown version numbers. Please run Rootkit Hunter
with the --update parameter or contact us through the Rootkit Hunter mailinglist
at rkhunter-users@lists.sourceforge.net.
Security advisories
* Check: Groups and Accounts
Searching for /etc/passwd... [ Found ]
Checking users with UID '0' (root)... [ OK ]
* Check: SSH
Searching for sshd_config...
Found /etc/ssh/sshd_config
Checking for allowed root login... Watch out Root login possible. Possible risk!
info: "PermitRootLogin yes" found in file /etc/ssh/sshd_config
Hint: See logfile for more information about this issue
Checking for allowed protocols... [ OK (Only SSH2 allowed) ]
* Check: Events and Logging
Search for syslog configuration... [ OK ]
Checking for running syslog slave... [ OK ]
Checking for logging to remote system... [ OK (no remote logging) ]
[Press to continue]
---------------------------- Scan results ----------------------------
MD5 scan
Skipped
File scan
Scanned files: 342
Possible infected files: 0
Application scan
Vulnerable applications: 0
Scanning took 66 seconds
-----------------------------------------------------------------------
Do you have some problems, undetected rootkits, false positives, ideas
or suggestions? Please e-mail us through the Rootkit Hunter mailinglist
at rkhunter-users@lists.sourceforge.net.
-----------------------------------------------------------------------
#
"hidden files" で chkrootkit とは異なるファイルが指摘された。
こちらも特に問題は無い様だ。
chkrootkit に引き続き rkhunter も恙なく終了して何より。
May 28, 2009
[Linux] chkrootkit を試してみた。
chkrootkit は rootkit を検出してくれるツール。 面白そうなので試してみた。
- chkrootkit
- http://www.chkrootkit.org/
chkrootkit のインストール
chkrootkit 0.47 を Debian Etch にインストールした。 apt でインストール出来るので非常に楽。
# apt-get install chkrootkit Reading package lists... Done Building dependency tree... Done The following NEW packages will be installed: chkrootkit (SNIP) Unpacking chkrootkit (from .../chkrootkit_0.47-2_i386.deb) ... Setting up chkrootkit (0.47-2) ... # chkrootkit -V chkrootkit version 0.47
chkrootkit の実行
"suspicious file" で指摘されたファイルは調べてみたところ特に危険では無い様だ。 特に問題は無くて何より。# chkrootkit ROOTDIR is `/' Checking `amd'... not found Checking `basename'... not infected Checking `biff'... not found Checking `chfn'... not infected Checking `chsh'... not infected Checking `cron'... not infected Checking `crontab'... not infected Checking `date'... not infected Checking `du'... not infected Checking `dirname'... not infected Checking `echo'... not infected Checking `egrep'... not infected Checking `env'... not infected Checking `find'... not infected Checking `fingerd'... not found Checking `gpm'... not found Checking `grep'... not infected Checking `hdparm'... not found Checking `su'... not infected Checking `ifconfig'... not infected Checking `inetd'... not infected Checking `inetdconf'... not infected Checking `identd'... not found Checking `init'... not infected Checking `killall'... not found Checking `ldsopreload'... not infected Checking `login'... not infected Checking `ls'... not infected Checking `lsof'... not found Checking `mail'... not infected Checking `mingetty'... not found Checking `netstat'... not infected Checking `named'... not infected Checking `passwd'... not infected Checking `pidof'... not infected Checking `pop2'... not found Checking `pop3'... not found Checking `ps'... not infected Checking `pstree'... not found Checking `rpcinfo'... not infected Checking `rlogind'... not found Checking `rshd'... not found Checking `slogin'... not infected Checking `sendmail'... not infected Checking `sshd'... not infected Checking `syslogd'... not infected Checking `tar'... not infected Checking `tcpd'... not infected Checking `tcpdump'... not infected Checking `top'... not infected Checking `telnetd'... not found Checking `timed'... not found Checking `traceroute'... not infected Checking `vdir'... not infected Checking `w'... not infected Checking `write'... not infected Checking `aliens'... no suspect files Searching for sniffer's logs, it may take a while... nothing found Searching for HiDrootkit's default dir... nothing found Searching for t0rn's default files and dirs... nothing found Searching for t0rn's v8 defaults... nothing found Searching for Lion Worm default files and dirs... nothing found Searching for RSHA's default files and dir... nothing found Searching for RH-Sharpe's default files... nothing found Searching for Ambient's rootkit (ark) default files and dirs... nothing found Searching for suspicious files and dirs, it may take a while... /usr/lib/iceape/.autoreg /lib/init/rw/.ramfs Searching for LPD Worm files and dirs... nothing found Searching for Ramen Worm files and dirs... nothing found Searching for Maniac files and dirs... nothing found Searching for RK17 files and dirs... nothing found Searching for Ducoci rootkit... nothing found Searching for Adore Worm... nothing found Searching for ShitC Worm... nothing found Searching for Omega Worm... nothing found Searching for Sadmind/IIS Worm... nothing found Searching for MonKit... nothing found Searching for Showtee... nothing found Searching for OpticKit... nothing found Searching for T.R.K... nothing found Searching for Mithra... nothing found Searching for OBSD rk v1... nothing found Searching for LOC rootkit... nothing found Searching for Romanian rootkit... nothing found Searching for Suckit rootkit... nothing found Searching for Volc rootkit... nothing found Searching for Gold2 rootkit... nothing found Searching for TC2 Worm default files and dirs... nothing found Searching for Anonoying rootkit default files and dirs... nothing found Searching for ZK rootkit default files and dirs... nothing found Searching for ShKit rootkit default files and dirs... nothing found Searching for AjaKit rootkit default files and dirs... nothing found Searching for zaRwT rootkit default files and dirs... nothing found Searching for Madalin rootkit default files... nothing found Searching for Fu rootkit default files... nothing found Searching for ESRK rootkit default files... nothing found Searching for rootedoor... nothing found Searching for ENYELKM rootkit default files... nothing found Searching for anomalies in shell history files... nothing found Checking `asp'... not infected Checking `bindshell'... not infected Checking `lkm'... chkproc: nothing detected Checking `rexedcs'... not found Checking `sniffer'... lo: not promisc and no packet sniffer sockets eth0: PACKET SNIFFER(/usr/sbin/snort[647]) Checking `w55808'... not infected Checking `wted'... chkwtmp: nothing deleted Checking `scalper'... not infected Checking `slapper'... not infected Checking `z2'... chklastlog: nothing deleted #
May 22, 2009
[Linux] 古い Fedora Core における yum のエラー
Fedora Core 5, 6 辺りで 2009/05 現在 yum を実行すると以下の様なエラーが発生することがある。
# yum check-update Loading "installonlyn" plugin Setting up repositories Error: Cannot find a valid baseurl for repo: updates #
昔は動いていたはずなので、どうも yum リポジトリのミラーリスト取得方法が変更された様だ。 対応方法をメモしておく。# yum check-update Loading "installonlyn" plugin Setting up repositories Error: Cannot find a valid baseurl for repo: extras #
yum リポジトリの設定変更方法
・・・Fedora 5 か。懐かしい響きだ。# cp /etc/yum.repos.d/fedora-updates.repo /etc/yum.repos.d/fedora-updates.repo.original # vi /etc/yum.repos.d/fedora-updates.repo # diff /etc/yum.repos.d/fedora-updates.repo.original /etc/yum.repos.d/fedora-updates.repo 4c4 < mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-fc$releasever&arch=$basearch --- > mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch 12c12 < mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-fc$releasever&arch=$basearch --- > mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-f$releasever&arch=$basearch 20c20 < mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-fc$releasever&arch=$basearch --- > mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-f$releasever&arch=$basearch # cp /etc/yum.repos.d/fedora-extras.repo /etc/yum.repos.d/fedora-extras.repo.original # vi /etc/yum.repos.d/fedora-extras.repo # diff /etc/yum.repos.d/fedora-extras.repo.original /etc/yum.repos.d/fedora-extras.repo 5c5 < enabled=1 --- > enabled=0 #
Apr 27, 2009
[Linux] iptables -F に気をつけよう
iptables -F はルールのクリアを行うが、ポリシーのクリアは行わない。 例えば
という設定の時に iptables -F を実行しようものならChain INPUT (policy DROP) target prot opt source destination ACCEPT tcp -- anywhere anywhere tcp dpt:http state NEW ACCEPT tcp -- anywhere anywhere tcp dpt:ssh state NEW Chain FORWARD (policy DROP) target prot opt source destination Chain OUTPUT (policy DROP) target prot opt source destination
という状態になってしまい、全てのパケットが DROP されて頭を抱えることに。 必ず iptables -F の前にポリシーを確認しよう、という教訓。Chain INPUT (policy DROP) target prot opt source destination Chain FORWARD (policy DROP) target prot opt source destination Chain OUTPUT (policy DROP) target prot opt source destination
iptables の設定を大きく変更するときに少しでも不安があったら
を予め仕込んでおくことを忘れない様にしたい。(sleep 60; /etc/init.d/iptables restart) &
Feb 15, 2009
[Linux] Debian GNU/Linux 5.0 "lenny" リリース
Debian GNU/Linux 5.0 "lenny" がリリースされた。 Java 関連が大幅に改善されている様で期待大!!
- Debian GNU/Linux 5.0 がリリース
- http://www.debian.org/News/2009/20090214
何となく過去のリリース
- Debian GNU/Linux 4.0 がリリース(Etch)
- http://www.debian.org/News/2007/20070408
- Debian GNU/Linux 3.0 リリース(Woody)
- http://www.debian.org/News/2002/20020719
- Debian GNU/Linux 2.0 'Hamm' リリース(Hamm)
- http://www.debian.org/News/1998/19980724
Oct 30, 2008
[Linux] apt-get で Debian Unofficial からパッケージを取得する
"apt-cache search" で欲しいパッケージが見つからない。 そんなときに重宝するのが Debian Unofficial だそうだ。 Debian Unofficial では公式サイトにはないパッケージを多数用意してくれているということで "make" が面倒なものぐさ人間には非常に有り難い。
Debian Unofficial is a repository for packages not available within the official Debian repository. It contains packages which are not distributable within Debian due to special license terms as well as packages which are not included in Debian due to political reasons (e.g. alleged possible patent infrigement, binary-only/no sources, or special too restrictive licenses).
- Debian Unofficial
- http://www.debian-unofficial.org/
Debian Unofficial の設定
/etc/apt/sources.list に以下を追記する。
deb http://ftp.debian-unofficial.org/debian etch main contrib non-free restricted deb-src http://ftp.debian-unofficial.org/debian etch main contrib non-free restricted
"GPG error" の対処
上記設定を行い、"apt-get update" を行うと、下記の様なエラーが出る。
# apt-get update
(略)
Fetched 7605kB in 6s (1167kB/s)
Reading package lists... Done
W: GPG error: http://ftp.debian-unofficial.org etch Release: The following signatures
couldn't be verified because the public key is not available: NO_PUBKEY 394D199524C52AC3
W: You may want to run apt-get update to correct these problems
#
このエラーの対処方法は Debian Unofficial の FAQ に記載されている。
- Debian Unofficial - 5. Frequently Asked Questions (FAQ)
- http://www.debian-unofficial.org/faq.html
まず、エラーメッセージにある PUBKEY から gpg コマンドを使用してキーを取得する。
次に取得したキーを apt に登録する。# gpg --keyserver subkeys.pgp.net --recv-keys 394D199524C52AC3 gpg: requesting key 24C52AC3 from hkp server subkeys.pgp.net gpg: key 24C52AC3: public key "Debian Unofficial Archive Automatic Signing Key (2007)" imported gpg: no ultimately trusted keys found gpg: Total number processed: 1 gpg: imported: 1 #
これで OK。# gpg --armor --export 394D199524C52AC3 | apt-key add - OK #
# apt-get update
(略)
Ign http://ftp.debian-unofficial.org etch/main Sources/DiffIndex
Ign http://ftp.debian-unofficial.org etch/contrib Sources/DiffIndex
Ign http://ftp.debian-unofficial.org etch/non-free Sources/DiffIndex
Ign http://ftp.debian-unofficial.org etch/restricted Sources/DiffIndex
Hit http://ftp.debian-unofficial.org etch/main Packages
Hit http://ftp.debian-unofficial.org etch/contrib Packages
Hit http://ftp.debian-unofficial.org etch/non-free Packages
Hit http://ftp.debian-unofficial.org etch/restricted Packages
Hit http://ftp.debian-unofficial.org etch/main Sources
Hit http://ftp.debian-unofficial.org etch/contrib Sources
Hit http://ftp.debian-unofficial.org etch/non-free Sources
Hit http://ftp.debian-unofficial.org etch/restricted Sources
Fetched 191B in 2s (82B/s)
Reading package lists... Done
#
ちなみに、apt に登録されたキーは以下で確認できる。
# apt-key list
/etc/apt/trusted.gpg
--------------------
(略)
pub 1024D/24C52AC3 2007-01-24 [expired: 2008-02-01]
uid Debian Unofficial Archive Automatic Signing Key (2007)
#
それにしても、既に失効済みの 2007 年のキーが必要なのは何故だろう?
FAQ では 2008 年のキーをインストールする手順が記載されているのに。
Oct 17, 2008
[Linux] GNU date コマンドで来月の日付を取得する方法をメモ
GNU date コマンドで来月の日付を取得する方法をメモしておく。 使用した GNU date コマンドのバージョンは以下の通り。
$ date --version date (coreutils) 5.2.1 Written by David MacKenzie. Copyright (C) 2004 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [参考訳] これはフリーソフトウェアです. コピーの条件についてはソースをお読みください. 市場性及び特定目的適合性の如何によらず, いかなる保証もありません.
年
1 年後、1 年前などの日付を取得するには "year" もしくは "years" が使用できる。
$ date +"%Y%m%d" --date "1 year" 20091017 $ date +"%Y%m%d" --date "1 years" 20091017 $ date +"%Y%m%d" --date "10 years" 20181017 $ date +"%Y%m%d" --date "1 year ago" 20071017 $ date +"%Y%m%d" --date "1 years ago" 20071017 $ date +"%Y%m%d" --date "10 years ago" 19981017
月
1 ヶ月後、1 ヶ月前などの日付を取得するには "month" もしくは "months" が使用できる。
$ date +"%Y%m%d" --date "1 month" 20081117 $ date +"%Y%m%d" --date "1 months" 20081117 $ date +"%Y%m%d" --date "10 month" 20090817 $ date +"%Y%m%d" --date "1 month ago" 20080917 $ date +"%Y%m%d" --date "1 months ago" 20080917 $ date +"%Y%m%d" --date "10 month ago" 20071217
週
1 週間後、1 週間前などの日付を取得するには "week" もしくは "weeks" が使用できる。
$ date +"%Y%m%d" --date "1 week" 20081024 $ date +"%Y%m%d" --date "1 weeks" 20081024 $ date +"%Y%m%d" --date "10 weeks" 20081226 $ date +"%Y%m%d" --date "1 week ago" 20081010 $ date +"%Y%m%d" --date "1 weeks ago" 20081010 $ date +"%Y%m%d" --date "10 weeks ago" 20080808
日
1 日後、1 日前などの日付を取得するには "day" もしくは "days" が使用できる。
$ date +"%Y%m%d" --date "1 day" 20081018 $ date +"%Y%m%d" --date "1 days" 20081018 $ date +"%Y%m%d" --date "200 days" 20090505 $ date +"%Y%m%d" --date "1 day ago" 20081016 $ date +"%Y%m%d" --date "1 days ago" 20081016 $ date +"%Y%m%d" --date "300 days ago" 20071222
その他(時間、分、秒)
時間であれば "hour", "hours"、分であれば "minute", "minutes"、秒であれば "second", "seconds" で上記と同様のことができる。
`man date` より関連部分を抜粋
date(1)
名前
date - システムの日付と時刻を表示・設定する
書式
date [-uR] [-d datestr] [-f datefile] [-r file] [-s datestr] [-I
[timespec]] [--date=datestr] [--file=datefile] [--iso-8601[=timespec]]
[--reference=file] [--set=datestr] [--rfc-822] [--universal] [--utc]
[+format] [MMDDhhmm[[CC]YY][.ss]]
date [--help] [--version]
(略)
時刻フィールド
%H 時 (00..23)
%I 時 (01..12)
%k 時 (0..23)
%l 時 (1..12)
%M 分 (00..59)
%p AM あるいは PM のロケール
%r 時刻、12 時間 (hh:mm:ss [AP]M)
%s 1970-01-01 00:00:00 UTC からの秒数 (標準外の拡張)
%S 秒 (00..60)
%T 時刻、24 時間 (hh:mm:ss)
%X ロケールによる時刻の表現 (%H:%M:%S)
%Z タイムゾーン (例 EDT)、あるいはタイムゾーンが決定できないならば
無し
日付フィールド
%a ロケールの省略形の曜日名 (Sun..Sat)
%A ロケールの完全表記の曜日名、可変長 (Sunday..Saturday)
%b ロケールの省略形の月名 (Jan..Dec)
%B ロケールの完全表記の月名、可変長 (January..December)
%c ロケールの日付と時刻 (Sat Nov 04 12:02:33 EST 1989)
%d 月内通算日数 (01..31)
%D 日付 (mm/dd/yy)
%h %b と同じ
%j 年内通算日数 (001..366)
%m 月 (01..12)
%U 日曜日を週の最初の日とした年内通算週 (00..53)
%w 週のうちの曜日 (0..6) (0 が日曜日)
%W 月曜日を週の最初の日とした年内通算週 (00..53)
%x ロケールの日付表現 (mm/dd/yy)
%y 年の最後の 2 つの数字 (00..99)
%Y 年 (1970...)
(略)
-d datestr, --date datestr
現在の時刻・日付の代わりに、 datestr で指定された時刻・日付を表
示する。 datestr は普通のフォーマットならだいたいなんでも使うこ
とができる。月名、タイムゾーン、‘am’ や ‘pm’ なども用いてよい。
(略)
例
一昨日の日付を表示するには:
date --date ´2 days ago´
3 ヶ月と 1 日後の日付を表示するには:
date --date ´3 months 1 day´
今年のクリスマスが年の初めから何日目かを表示するには:
date --date ´25 Dec´ +%j
(略)
Sep 17, 2008
[Linux] tar 実行時に不思議なエラーに遭遇
tar 実行時に不思議なエラーに遭遇した。
色々調べてようやく原因が分かった。 2Gbyte 以上のファイルを生成できないプラットフォームで、tar ファイルが 2Gbyte を超えた為に発生していたらしい。 余りに便利になりすぎて、一昔前の制約をどんどん忘れていく今日この頃。 幸せなことだけれど、たまにこういう落とし穴にはまる orztar: Only wrote 2047 of 10240 bytes to ./dummy.tar tar: Error is not recoverable: exiting now
ちなみに、発生したのはかなり昔の LinkStation 上。
Sep 07, 2008
[Linux] CentOS 5 に PostgreSQL をインストール
CentOS 5 に PostgreSQL をインストールしたときのメモ。 CentOS 5 にデフォルト状態で設定されている yum のリポジトリには 2008/09/07 現在 PostgreSQL 8.1.11 しか登録されていない。 今回は 8.1 ではなく 8.2 をインストールしたいので、8.2 をインストール出来るよう設定をしてみた。
- RepoView: PostgreSQL PGDG Repository RPMs - Letter P
- http://yum.pgsqlrpms.org/reporpms/repoview/letter_p.group.html
- pgdg-centos - PostgreSQL 8.4.X PGDG RPMs for CentOS - Yum Repository Configuration
- http://yum.pgsqlrpms.org/reporpms/repoview/pgdg-centos.html
CentOS 5 のデフォルト状態
CentOS 5 をクリーンインストールした直後はこんな感じ。
# yum search postgresql postgresql-server.i386 : The programs needed to create and run a PostgreSQL server. postgresql-docs.i386 : Extra documentation for PostgreSQL perl-DBD-Pg.i386 : A PostgresSQL interface for perl qt4-postgresql.i386 : PostgreSQL drivers for Qt's SQL classes postgresql-test.i386 : The test suite distributed with PostgreSQL. libdbi-dbd-pgsql.i386 : PostgreSQL plugin for libdbi postgresql-devel.i386 : PostgreSQL development header files and libraries. php-pdo.i386 : A database access abstraction module for PHP applications freeradius-postgresql.i386 : postgresql bindings for freeradius postgresql-contrib.i386 : Contributed source and binaries distributed with PostgreSQL php-pgsql.i386 : A PostgreSQL database module for PHP. qt-PostgreSQL.i386 : PostgreSQL drivers for Qt's SQL classes. php-pgsql.i386 : A PostgreSQL database module for PHP. postgresql-libs.i386 : The shared libraries required for any PostgreSQL clients. postgresql-pl.i386 : The PL procedural languages for PostgreSQL. postgresql-libs.i386 : The shared libraries required for any PostgreSQL clients. rhdb-utils.i386 : Miscellaneous utilities for PostgreSQL - CentOS Edition. mod_auth_pgsql.i386 : Basic authentication for the Apache web server using a PostgreSQL database. unixODBC.i386 : A complete ODBC driver manager for Linux. mono-data-postgresql.i386 : Postgresql database connectivity for Mono postgresql-jdbc.i386 : JDBC driver for PostgreSQL php-pdo.i386 : A database access abstraction module for PHP applications postgresql.i386 : PostgreSQL client programs and libraries. bind-sdb.i386 : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server with database backends. bind-sdb.i386 : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server with database backends. pdns-backend-postgresql.i386 : PostgreSQL backend for pdns bind-sdb.i386 : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server with database backends. postgresql-python.i386 : Development module for Python code to access a PostgreSQL DB. postgresql-odbc.i386 : PostgreSQL ODBC driver. postgresql-tcl.i386 : A Tcl client library for PostgreSQL. # yum install postgresql-server Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package postgresql-server.i386 0:8.1.11-1.el5_1.1 set to be updated --> Processing Dependency: postgresql = 8.1.11-1.el5_1.1 for package: postgresql-server --> Running transaction check ---> Package postgresql.i386 0:8.1.11-1.el5_1.1 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: postgresql-server i386 8.1.11-1.el5_1.1 base 3.9 M Installing for dependencies: postgresql i386 8.1.11-1.el5_1.1 base 2.9 M Transaction Summary ============================================================================= Install 2 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 6.7 M Is this ok [y/N]: N Exiting on user Command Complete!
yum の設定
yum に PostgreSQL のリポジトリを登録する。 今回は訳あって 8.3 ではなく 8.2 が必要なので、8.2 用のリポジトリを登録する。
# wget http://yum.pgsqlrpms.org/reporpms/8.2/pgdg-centos-8.2-4.noarch.rpm --17:44:40-- http://yum.pgsqlrpms.org/reporpms/8.2/pgdg-centos-8.2-4.noarch.rpm (略) 17:44:40 (2.88 MB/s) - `pgdg-centos-8.2-4.noarch.rpm' saved [4311/4311] # rpm -ivh ./pgdg-centos-8.2-4.noarch.rpm Preparing... ########################################### [100%] 1:pgdg-centos ########################################### [100%]
PostgreSQL のインストール
リポジトリの登録が終わったので、早速 PostgreSQL 8.2 をインストールしてみる。
# yum search postgresql pgdg82 100% |=========================| 1.9 kB 00:00 primary.sqlite.bz2 100% |=========================| 45 kB 00:00 python-psycopg2-doc.i386 : Documentation for psycopg python PostgreSQL database adapter slony1-docs.i386 : Documentation for Slony-I python-psycopg2-doc.i386 : Documentation for psycopg python PostgreSQL database adapter pgpool-II-debuginfo.i386 : Debug information for package pgpool-II pgpool-II-devel.i386 : The development files for pgpool-II pgpool-debuginfo.i386 : Debug information for package pgpool pgpool-II.i386 : Pgpool is a connection pooling/replication server for PostgreSQL perl-DBD-Pg.i386 : A PostgresSQL interface for perl postgresql-plpython.i386 : The Python procedural language for PostgreSQL postgresql-jdbc.i386 : JDBC driver for PostgreSQL postgresql-libs.i386 : The shared libraries required for any PostgreSQL clients. postgresql-libs.i386 : The shared libraries required for any PostgreSQL clients. dbi-link.noarch : Partial implementation of the SQL/MED portion of the SQL:2003 specification postgresql-test.i386 : The test suite distributed with PostgreSQL. skytools.i386 : PostgreSQL database management tools from Skype libpqxx.i386 : C++ client API for PostgreSQL pgsphere.i386 : R-Tree implementation using GiST for spherical objects bind-sdb.i386 : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server with database backends. pdns-backend-postgresql.i386 : PostgreSQL backend for pdns pgdg-redhat.noarch : PostgreSQL 8.2.X PGDG RPMs for RHEL - Yum Repository Configuration postgresql-odbc.i386 : PostgreSQL ODBC driver phpPgAdmin.noarch : Web-based PostgreSQL administration postgresql-docs.i386 : Extra documentation for PostgreSQL pgpool.i386 : Pgpool is a connection pooling/replication server for PostgreSQL qt4-postgresql.i386 : PostgreSQL drivers for Qt's SQL classes postgresql-pltcl.i386 : The Tcl procedural language for PostgreSQL python-psycopg2.i386 : A PostgreSQL database adapter for Python odbcng.i386 : PostgreSQL ODBCng driver postgresql-libs.i386 : The shared libraries required for any PostgreSQL clients postgresql-test.i386 : The test suite distributed with PostgreSQL postgresql-python.i386 : Development module for Python code to access a PostgreSQL DB postgresql-tcl-debuginfo.i386 : Debug information for package postgresql-tcl php-pgsql.i386 : A PostgreSQL database module for PHP. postgresql-plperl.i386 : The Perl procedural language for PostgreSQL postgresql-tcl.i386 : Tcl client library for PostgreSQL ptop.i386 : 'top' for PostgreSQL process ip4r.i386 : IPv4 and IPv4 range index types for PostgreSQL postgresql-contrib.i386 : Contributed source and binaries distributed with PostgreSQL table_log.i386 : Log data changes in a PostgreSQL table unixODBC.i386 : A complete ODBC driver manager for Linux. postgis.i386 : Geographic Information Systems Extensions to PostgreSQL python-psycopg2.i386 : A PostgreSQL database adapter for Python pgfouine.noarch : PgFouine PostgreSQL log analyzer postgresql-devel.i386 : PostgreSQL development header files and libraries. postgresql-server.i386 : The programs needed to create and run a PostgreSQL server postgresql-jdbc-debuginfo.i386 : Debug information for package postgresql-jdbc postgresql-devel.i386 : PostgreSQL development header files and libraries pgdg-centos.noarch : PostgreSQL 8.2.X PGDG RPMs for CentOS - Yum Repository Configuration postgresql-odbc.i386 : PostgreSQL ODBC driver. postgresql-tcl.i386 : A Tcl client library for PostgreSQL. postgis.i386 : Geographic Information Systems Extensions to PostgreSQL postgresql-odbc-debuginfo.i386 : Debug information for package postgresql-odbc postgresql-python-debuginfo.i386 : Debug information for package postgresql-python slony1-docs.i386 : Documentation for Slony-I pgplsh.i386 : Sh shell procedural language handler for PostgreSQL postgresql-contrib.i386 : Contributed source and binaries distributed with PostgreSQL usda-r18.noarch : The USDA Food Database Sample for PostgreSQL qt-PostgreSQL.i386 : PostgreSQL drivers for Qt's SQL classes. php-pgsql.i386 : A PostgreSQL database module for PHP. postgresql-debuginfo.i386 : Debug information for package postgresql pgadmin3.i386 : Graphical client for PostgreSQL rhdb-utils.i386 : Miscellaneous utilities for PostgreSQL - CentOS Edition. mono-data-postgresql.i386 : Postgresql database connectivity for Mono pgpool-II.i386 : Pgpool is a connection pooling/replication server for PostgreSQL pgdg-centos.noarch : PostgreSQL 8.2.X PGDG RPMs for CentOS - Yum Repository Configuration bind-sdb.i386 : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server with database backends. python-psycopg2-zope.i386 : Zope Database Adapter ZPsycopgDA postgresql-server.i386 : The programs needed to create and run a PostgreSQL server. plruby.i386 : PostgreSQL Ruby Procedural Language slony1.i386 : A "master to multiple slaves" replication system with cascading and failover libdbi-dbd-pgsql.i386 : PostgreSQL plugin for libdbi php-pdo.i386 : A database access abstraction module for PHP applications freeradius-postgresql.i386 : postgresql bindings for freeradius postgresql-pl.i386 : The PL procedural languages for PostgreSQL. postgresql-docs.i386 : Extra documentation for PostgreSQL compat-postgresql-libs-debuginfo.i686 : Debug information for package compat-postgresql-libs pagila.noarch : A sample database for PostgreSQL slony1.i386 : A "master to multiple slaves" replication system with cascading and failover python-psycopg2-zope.i386 : Zope Database Adapter ZPsycopgDA mod_auth_pgsql.i386 : Basic authentication for the Apache web server using a PostgreSQL database. pgpool-II-devel.i386 : The development files for pgpool-II postgresql-jdbc.i386 : JDBC driver for PostgreSQL php-pdo.i386 : A database access abstraction module for PHP applications postgresql.i386 : PostgreSQL client programs and libraries. bind-sdb.i386 : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server with database backends. postgresql.i386 : PostgreSQL client programs and libraries postgresql-python.i386 : Development module for Python code to access a PostgreSQL DB. compat-postgresql-libs.i686 : PostgreSQL client programs and libraries pgpool-II-debuginfo.i386 : Debug information for package pgpool-II # yum install postgresql-server Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package postgresql-server.i386 0:8.2.9-1PGDG.rhel5 set to be updated --> Processing Dependency: postgresql = 8.2.9 for package: postgresql-server --> Processing Dependency: libpq.so.5 for package: postgresql-server --> Running transaction check ---> Package postgresql-libs.i386 0:8.2.9-1PGDG.rhel5 set to be updated --> Processing Dependency: libpq.so.4 for package: apr-util ---> Package postgresql.i386 0:8.2.9-1PGDG.rhel5 set to be updated --> Running transaction check ---> Package compat-postgresql-libs.i686 0:4-1PGDG.rhel5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: postgresql-server i386 8.2.9-1PGDG.rhel5 pgdg82 4.0 M Updating: postgresql-libs i386 8.2.9-1PGDG.rhel5 pgdg82 196 k Installing for dependencies: compat-postgresql-libs i686 4-1PGDG.rhel5 pgdg82 63 k postgresql i386 8.2.9-1PGDG.rhel5 pgdg82 1.6 M Transaction Summary ============================================================================= Install 3 Package(s) Update 1 Package(s) Remove 0 Package(s) Total download size: 5.9 M Is this ok [y/N]: y Downloading Packages: (1/4): postgresql-server- 100% |=========================| 4.0 MB 00:12 (2/4): postgresql-8.2.9-1 100% |=========================| 1.6 MB 00:02 (3/4): compat-postgresql- 100% |=========================| 63 kB 00:00 (4/4): postgresql-libs-8. 100% |=========================| 196 kB 00:00 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Updating : postgresql-libs ######################### [1/5] Installing: postgresql ######################### [2/5] Installing: compat-postgresql-libs ######################### [3/5] Installing: postgresql-server ######################### [4/5] Cleanup : postgresql-libs ######################### [5/5] Installed: postgresql-server.i386 0:8.2.9-1PGDG.rhel5 Dependency Installed: compat-postgresql-libs.i686 0:4-1PGDG.rhel5 postgresql.i386 0:8.2.9-1PGDG.rhel5 Updated: postgresql-libs.i386 0:8.2.9-1PGDG.rhel5 Complete! # psql --version psql (PostgreSQL) 8.2.9 contains support for command-line editing #
Nov 20, 2007
[Linux] "yum remove openssl" の恐怖
会社の先輩が苦悶しているので何事かと思ったら。
"yum remove openssl" を実行したら 200 以上のパッケージと "yum 自身" が削除されたらしい。
確かに openssl は他パッケージからの依存がかなり多くてもおかしくはない。
とは言え、yum 自身までもが消えるとは。恐るべし。
ちなみに、"ls" まで使えなくなったらしいので shell にもダメージがある模様。
注意されたい。
・・・apt は大丈夫なのだろうか?? 怖くて試す気にはなれないが。
再現実験をしてみた(w
2008/01/25 追記
apt で試したという強者が(w。
☆★☆- ログ倉庫・・・っぽいもの、若しくは鯖メモ -☆★☆ さんの 「 便利さの裏側に潜む狂気」というエントリ。
厳しい警告が出る様だが、強行してしまうと yum 同様取り返しのつかないことになるそうだ。
May 01, 2007
[Linux] Debian Etch + Apache2.2 で ActiveDirectory 認証にチャレンジ
Debian Etch で Apache2.2 から Windows 2003 Server の ActiveDirectory を使用してユーザ認証設定をした。 上手く行くまでに結構苦労したので、メモ。
今回は Subversion の認証を ActiveDirectory で行うことにした。 /etc/apache2/mods-available/dav_svn.conf を色々編集していたのだが、中々上手く行かなかった。 結局下記の様に設定することで正常にユーザ認証できるようになった。
<Location /svn>
...SNIP...
AuthType Basic
AuthName "Subversion Repositoryr"
AuthBasicProvider ldap
AuthLDAPUrl "ldap://pdc.example.com:389/OU=employees,dc=example,dc=com?sAMAccountName?sub?(objectClass=*)"
AuthLDAPBindDN ldap@example.com
AuthLDAPBindPassword ldap-user-password
Require ldap-attribute objectClass=person
</Location>
AuthLDAPUrl、AuthLDAPBindDN、AuthLDAPBindPassword は色々なサイトに記述されている通りで問題は無かったのだが(強いて言えば、私の試した環境では AuthLDAPUrl に OU を指定しないと動作しなかった)、 Require ディレクティブの設定でかなり時間をかけてしまった。
Require ディレクティブに
Require valid-user
や
Require ldap-user
と記述すると、ActiveDirectory の認証は上手く行くのだが Apache が認証エラーを返してしまう。
その場合、Apache の error.log には何も表示されず原因が分かりづらい。
結局、mod_authnz_ldap のマニュアルに記述されていた Require ディレクティブの解説通りの設定をしたら正常に認証されるようになった。
- Apache Module mod_authnz_ldap
- http://httpd.apache.org/docs/2.2/mod/mod_authnz_ldap.html
- require ldap-attribute
- http://httpd.apache.org/docs/2.2/mod/mod_authnz_ldap.html#reqattribute
Apr 27, 2007
[Linux] 巨大なデータの tar アーカイビングに苦戦
大量のデータを tar でアーカイビングしようとして苦戦。 最初は特に意識せず普通に
とやったのだが、tar cvf /home/foo.tar ./foo
と怒られてしまった。 それなら、とtar: Cannot write to /home/foo.tar: File too large tar: Error is not recoverable: exiting now
と bzip2 圧縮をかけたのだが、tar --use=bzip2 -cvf /home/foo.tar.bz2 ./foo
bzip2: I/O or other error, bailing out. Possible reason follows.
bzip2: File too large
Input file = (stdin), output file = (stdout)
Broken pipe
と、またツレナイ結果に。
結局仕方が無いので
#!/bin/sh
src=./foo
dest=/home/
prefix=foo.
suffix=.tar.bz2
cd $src
for i in * ; do
if [ -d $i ] ; then
echo "archiving $i... -> $dest/$prefix$i$suffix"
tar --use=bzip2 -cvf $dest/$prefix$i$suffix $i > /dev/null
fi
done
とディレクトリ個別にアーカイビングするハメに。
もっと良い方法がある気がするのだが。
どうすれば良いのだろう??
Apr 19, 2007
[Linux] Debian Etch で Apache2.2 + SSL
Debian Etch がリリースされたので、Sarge からアップグレードしてみた。 apt の dist-upgrade は少々不安だったので(^^;、クリーンインストールで。 特に何事もなく進んで喜んでいたのだが、Apache2.2 + SSL の設定で思わぬ苦戦をした。 ということで、最終的に上手くいった方法をメモ。
openssl のインストール
example:/# apt-get install openssl Reading package lists... Done Building dependency tree... Done Suggested packages: ca-certificates The following NEW packages will be installed: openssl 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 1004kB of archives. After unpacking 2351kB of additional disk space will be used. Get:1 http://ftp.jp.debian.org etch/main openssl 0.9.8c-4 [1004kB] Fetched 1004kB in 8s (122kB/s) Selecting previously deselected package openssl. (Reading database ... 18787 files and directories currently installed.) Unpacking openssl (from .../openssl_0.9.8c-4_i386.deb) ... Creating directory /etc/ssl Setting up openssl (0.9.8c-4) ... example:/#
openssl の設定
よしだメモ さんの [linux]Debian etchでSSL に書いてあった通りに /etc/ssl/openssl.cnf を編集。
[usr_cert]セクションのnsCertType=serverのコメントアウトを外す
[v3_ca]セクションのnsCertType=sslCA,emailCAのコメントアウトを外す
証明書の作成
こちらもよしだメモさんのエントリ通りに作業。
example:/# cd /usr/lib/ssl/misc/
example:/usr/lib/ssl/misc# ./CA.sh -newca
CA certificate filename (or enter to create)
Making CA certificate ...
Generating a 1024 bit RSA private key
.............++++++
..................................................................++++++
writing new private key to './demoCA/private/./cakey.pem'
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:
-----
...SNIP...
Certificate is to be certified until Apr 17 01:07:26 2010 GMT (1095 days)
Write out database with 1 new entries
Data Base Updated
example:/usr/lib/ssl/misc# openssl rsa -in ./demoCA/private/cakey.pem -out ./demoCA/private/cakey.pem
Enter pass phrase for ./demoCA/private/cakey.pem:
writing RSA key
example:/usr/lib/ssl/misc# openssl x509 -in ./demoCA/cacert.pem -out ./demoCA/cacert.crt
example:/usr/lib/ssl/misc# openssl x509 -inform pem -in ./demoCA/cacert.pem -outform der -out ./demoCA/ca.der
証明書を Apache に登録
で、/etc/apache2/ssl/cacert.crt と /etc/apache2/ssl/private/cakey.pem を httpd-ssl.conf に登録。 ついでに、ServerName やら何やらも設定しておく。example:/usr/lib/ssl/misc/demoCA# mkdir /etc/apache2/ssl example:/usr/lib/ssl/misc/demoCA# cp ./cacert.crt /etc/apache2/ssl example:/usr/lib/ssl/misc/demoCA# cd private/ example:/usr/lib/ssl/misc/demoCA/private# mkdir /etc/apache2/ssl/private example:/usr/lib/ssl/misc/demoCA/private# cp ./cakey.pem /etc/apache2/ssl/private/ example:/usr/lib/ssl/misc/demoCA/private# cd /etc/apache2/sites-available example:/etc/apache2/sites-available# cp /usr/share/doc/apache2.2-common/examples/apache2/extra/httpd-ssl.conf.gz ./ example:/etc/apache2/sites-available# gzip -d ./httpd-ssl.conf.gz example:/etc/apache2/sites-available# ln -s /etc/apache2/sites-available/httpd-ssl.conf /etc/apache2/sites-enabled/httpd-ssl.conf example:/etc/apache2/sites-available# vi ./httpd-ssl.conf
Apache で ssl モジュール有効化
example:/etc/apache2/sites-available# a2enmod ssl Module ssl installed; run /etc/init.d/apache2 force-reload to enable.
Apache 再起動
example:/etc/apache2/sites-available# apache2ctl -t Syntax OK example:/etc/apache2/sites-available# /etc/init.d/apache2 restart Forcing reload of web server (apache2)...httpd (no pid file) not running .
ローカルからの接続確認
example:~# openssl s_client -connect localhost:https
CONNECTED(00000003)
...SNIP...
---
GET / HTTP/1.0 ← これを入力して \n\n
HTTP/1.1 200 OK
Date: Thu, 19 Apr 2007 14:45:57 GMT
Server: Apache/2.2.3 (Debian) DAV/2 SVN/1.4.2 mod_ssl/2.2.3 OpenSSL/0.9.8c
Last-Modified: Fri, 11 Nov 2005 08:09:59 GMT
ETag: "1508105-65-a5c6e3c0"
Accept-Ranges: bytes
Content-Length: 101
Connection: close
Content-Type: text/html; charset=UTF-8
<html>
<head>
<meta http-equiv="refresh" content="0; URL=./blog/">
</head>
<body>
</body>
</html>
closed
example:~#
リモートから Web ブラウザで確認
後はリモートから Web ブラウザで https の接続を確認して完了。 たったこれだけで 1 週間以上悩んだ・・・ orz よしだメモ さんに大感謝!!
May 10, 2006
[Linux] Linux で起動してからの時間を調べる方法
Linux が起動してから経過した時間を調べる方法をメモ。 起動後の経過時間は /proc/uptime から取得することができる。
一つめの値が起動後の経過時間を秒数で表した数値となる。 後は電卓を叩いて日数や時間数に換算すれば良い。 電卓を起動するのが面倒な場合は AWK で計算しても良い。# cat /proc/uptime 2700777.74 2676642.02
# cat /proc/uptime | awk '{print $1 / 60 /60 /24 "days (" $1 "sec)"}'
31.2591days (2700784.86sec)
ただしこの値、32bit でカウントされているために 500 日程度でリセットされてしまうらしい。
(ともちゃ日記さんの [Linux] uptime より)
- Manpage of PROC
- http://www.linux.or.jp/JM/html/LDP_man-pages/man5/proc.5.html



