Linux関連メモ
■awkコマンドについて
▼ファイルのサイズとファイル名をサイズの少ない順で表示する。
$ ls -Slhr| awk '{print $6,$10}'
▼ファイルのサイズとファイル名をサイズの少ない順で表示する。(コロンを追加する)
$ ls -Slhr| awk '{print($6," ",":",$10)}'
※綺麗に「:」をそろえることができないか。
Linuxユーザパスワードが変更できない理由
□system-authの設定
以下の設定がデフォルトで3回になっていた。
3回以上は失敗したと考えられる。見直す必要があるかも。
retry=N N回まで失敗が許されます。
retry=3
passwdコマンドをいったん終了して再実行すれば問題なかったと思う。
□opasswdの削除
以下の2つのファイルをいらないと判断して消しました。
→/etc/pam.d/common-passwordは、RedHat系のLinuxには存在しないため。
→/etc/security/opasswd
確か、デフォルトでは作成されていなかったので手動で作成した。
ただパスワード履歴のDBとして必要と考えられる。DebianLinuxだけと思っていた。
以下のサイトに作成しないとだめとある
http://www.ilovex.co.jp/Division/ITD/archives/2006/05/linux_windows.html
http://memorandom-ayum.blogspot.jp/2008/04/blog-post.html
抜粋----------------------------------------------------------------------
touch /etc/security/opasswd
chomod 600 /etc/security/opasswd
てな感じで 事前にファイルを作っておかねばなりません。
opasswd ファイルを作っていないと、ユーザーがパスワード変更時にコケます。
---------------------------------------------------------------------------
※過去のパスワード履歴を初期化したい場合は、
/etc/security/opasswd に /dev/null を書き込んで空にすれば良い。
# cat /dev/null > /etc/security/opasswd
□passwdとshadowの整合性がある
passwdとshadowの整合性が取れていないためログインできなかった。
まずは、pwckコマンドで整合性がただしいかを確認する
整合性がおかしければそのあとにpwconvを実行する
□20120307kernel_bug_fixメモ
kernel bug fix
RHBA-2012:0361-1
2012-03-07
kernel-2.6.18-308.1.1.el5.i686.rpm MD5:
571511b1829455250480417b57a5c059
SHA-256: b8367f33e671645cab54c657166df6d8c94effa056ef491aa3e602f4542cd5a7
kernel-PAE-2.6.18-308.1.1.el5.i686.rpm MD5:
7fc7776e4f0c923e4123bf9d3f7ca179
SHA-256: ac92e519cf462f4e6efc57e223b3c11b33294908f53a978ad5dc89f86f0c8025
kernel-PAE-devel-2.6.18-308.1.1.el5.i686.rpm MD5:
4302812eac9b64b37d7885b325e7d23d
SHA-256: 9b25d9c8f437c304bddccb700c201a180f4f3f5dedfe3ecc0b75c40ecd0702e1
kernel-debug-2.6.18-308.1.1.el5.i686.rpm MD5:
745faa2fca6f192f2a51db5576a84d27
SHA-256: 697d0f9b408fbfb0cb3b82983b40d99c0cd79eb9c9f10c35f509917b7ccc3b3c
kernel-debug-devel-2.6.18-308.1.1.el5.i686.rpm MD5:
16e3d466ad92dee5bc48ead1dc4d4001
SHA-256: ef9a3e03b9ed7bbab85e5a40d7e19b45bd2b9cd0a4244f9fce6762fed2ba109f
kernel-devel-2.6.18-308.1.1.el5.i686.rpm MD5:
81f3c6c4ed5673a37f0661c629633f6a
SHA-256: ed47013197200b5d5d42253f6cc1c2f4f1831d2344a2bc33bf8ec16ab41bd4fa
kernel-doc-2.6.18-308.1.1.el5.noarch.rpm MD5:
c42a076660ae8dcb7a16d03e66f415ff
SHA-256: 00b7d28dabc6c49e02c89f0b720e48208abefeeb4536e0507f2d626e45394138
kernel-headers-2.6.18-308.1.1.el5.i386.rpm MD5:
e60dd963bd7418661f6dab14a0332554
SHA-256: 9a16083c13cb1fd0cd4fc2fdf4e0a0e4b13b45a549ddb7d2fd4dde8f382162c9
kernel-xen-2.6.18-308.1.1.el5.i686.rpm MD5:
ed332c2503d1c3f044e1b8aa408df9f3
SHA-256: f337aeaea15a2d8b9263634f9772a90a5ea129ecf61a03b55994fc90b16447e0
kernel-xen-devel-2.6.18-308.1.1.el5.i686.rpm MD5:
cd035a306565ad0f2c1405c84e3a7b35
SHA-256: eb7f45e0290fe4f70532dce0e1d13298789b54fa9483910b892c6a65f1b0897c
Updated kernel packages that fix multiple bugs are now available for Red
Hat
Enterprise Linux 5.
The kernel packages contain the Linux kernel, the core of any Linux
operating
system.
Bug fixes:
* The root user without the CAP_SYS_ADMIN capability was able to reset
the
contents of the "/proc/sys/kernel/dmesg_restrict" configuration file to 0.
Consequently, the unprivileged root user could bypass the protection of the
"dmesg_restrict" file and read the kernel ring buffer. This update ensures
that
only the root user with the CAP_SYS_ADMIN capability is allowed to write to
the
dmesg_restrict file. Any unauthorized attempt on writing to this file now
fails
with an EPERM error. (BZ#749246)
* An Ethernet physical transceiver (a PHY chip) was always powered up when
a
network interface card (NIC) using the igb driver was brought down. Recent
changes had modified the kernel so that the PHY chip was powered down in such
a
scenario. With this PHY power saving feature, the PHY chip could
unexpectedly
lose its settings on rare occasions. Consequently, the PHY chip did not
recover
after the NIC had been re-attached and the NIC could not be brought up. The
igb
driver has been modified so that the PHY chip is now reset when the NIC is
re-attached to the network. NICs using the igb driver are brought up as
expected. (BZ#786168)
* The way how the kernel processes dentries in the dcache when unmounting
file
systems allowed the concurrent activity on the list of dentries. If the list
was
large enough, the kernel could, under certain circumstances, panic due to
NMI
watchdog timeout triggered by the waiting concurrent process. This update
modifies underlying functions to use a private dcache list for certain
operations on the dcache so that concurrent activities are no longer affected
in
this scenario. (BZ#789369)
* The Abstract Control Model (ACM) driver uses spinlocks to protect the
lists of
USB Request Blocks (URBs) and read buffers maintained by the driver.
Previously,
when a USB device used the ACM interface, a race condition between scheduled
ACM
tasklets could occur. Consequently, the system could enter a deadlock
situation
because tasklets could take spinlocks without disabling interrupt requests
(IRQs). This situation resulted in various types of soft lockups ending up
with
a kernel panic. This update fixes the problem so that IRQs are disabled when
a
spinlock is taken. Deadlocks no longer occur and the kernel no longer crashes
in
this scenario. (BZ#790778)
* A recent change in the QLogic qla2xxx driver introduced a bug which
could,
under rare circumstances, cause the system to become unresponsive. This
problem
occurred during I/O error recovery on systems using SAN configurations with
QLogic Fibre Channel Hot Bus Adapters (HBAs). This update corrects the
qla2xxx
driver so the system no longer hangs in this scenario. (BZ#790907)
* Due to recent changes in the tg3 driver, the driver attempted to use
an
already freed pointer to a socket buffer (SKB) when the NIC was recovering
from
unsuccessful memory mapping. Consequently, the NIC went offline and the
kernel
panicked. With this update, the SKB pointer is newly allocated in this
scenario.
The NIC recovers as expected and a kernel panic does not occur. Also, the
tg3
driver could, under certain circumstances, attempt to unmap a memory
fragment
that had not been mapped. Consequently, the kernel panicked. This update
fixes
the bug by correcting the "last" parameter supplied. (BZ#790910)
* When a network interface card (NIC) with a fan experiences a fan failure,
the
PHY chip is usually powered down by its firmware. Previously, the bnx2x
driver
did not handle fan failures correctly, which could trigger a non-maskable
interrupt (NMI). Consequently, the kernel could crash or panic. This update
modifies the bnx2x driver to handle fan failures properly, the NIC is now
shut
down as expected and the kernel does not crash in this scenario.
(BZ#790912)
All users are advised to upgrade to these updated packages, which fix
these
bugs. The system must be rebooted for this update to take effect.
Updated kernel packages that fix multiple bugs are now available for Red
Hat
Enterprise Linux 5.
The kernel packages contain the Linux kernel, the core of any Linux
operating
system.
Bug fixes:
* The root user without the CAP_SYS_ADMIN capability was able to reset
the
contents of the "/proc/sys/kernel/dmesg_restrict" configuration file to 0.
Consequently, the unprivileged root user could bypass the protection of the
"dmesg_restrict" file and read the kernel ring buffer. This update ensures
that
only the root user with the CAP_SYS_ADMIN capability is allowed to write to
the
dmesg_restrict file. Any unauthorized attempt on writing to this file now
fails
with an EPERM error. (BZ#749246)
* An Ethernet physical transceiver (a PHY chip) was always powered up when
a
network interface card (NIC) using the igb driver was brought down. Recent
changes had modified the kernel so that the PHY chip was powered down in such
a
scenario. With this PHY power saving feature, the PHY chip could
unexpectedly
lose its settings on rare occasions. Consequently, the PHY chip did not
recover
after the NIC had been re-attached and the NIC could not be brought up. The
igb
driver has been modified so that the PHY chip is now reset when the NIC is
re-attached to the network. NICs using the igb driver are brought up as
expected. (BZ#786168)
* The way how the kernel processes dentries in the dcache when unmounting
file
systems allowed the concurrent activity on the list of dentries. If the list
was
large enough, the kernel could, under certain circumstances, panic due to
NMI
watchdog timeout triggered by the waiting concurrent process. This update
modifies underlying functions to use a private dcache list for certain
operations on the dcache so that concurrent activities are no longer affected
in
this scenario. (BZ#789369)
* The Abstract Control Model (ACM) driver uses spinlocks to protect the
lists of
USB Request Blocks (URBs) and read buffers maintained by the driver.
Previously,
when a USB device used the ACM interface, a race condition between scheduled
ACM
tasklets could occur. Consequently, the system could enter a deadlock
situation
because tasklets could take spinlocks without disabling interrupt requests
(IRQs). This situation resulted in various types of soft lockups ending up
with
a kernel panic. This update fixes the problem so that IRQs are disabled when
a
spinlock is taken. Deadlocks no longer occur and the kernel no longer crashes
in
this scenario. (BZ#790778)
* A recent change in the QLogic qla2xxx driver introduced a bug which
could,
under rare circumstances, cause the system to become unresponsive. This
problem
occurred during I/O error recovery on systems using SAN configurations with
QLogic Fibre Channel Hot Bus Adapters (HBAs). This update corrects the
qla2xxx
driver so the system no longer hangs in this scenario. (BZ#790907)
* Due to recent changes in the tg3 driver, the driver attempted to use
an
already freed pointer to a socket buffer (SKB) when the NIC was recovering
from
unsuccessful memory mapping. Consequently, the NIC went offline and the
kernel
panicked. With this update, the SKB pointer is newly allocated in this
scenario.
The NIC recovers as expected and a kernel panic does not occur. Also, the
tg3
driver could, under certain circumstances, attempt to unmap a memory
fragment
that had not been mapped. Consequently, the kernel panicked. This update
fixes
the bug by correcting the "last" parameter supplied. (BZ#790910)
* When a network interface card (NIC) with a fan experiences a fan failure,
the
PHY chip is usually powered down by its firmware. Previously, the bnx2x
driver
did not handle fan failures correctly, which could trigger a non-maskable
interrupt (NMI). Consequently, the kernel could crash or panic. This update
modifies the bnx2x driver to handle fan failures properly, the NIC is now
shut
down as expected and the kernel does not crash in this scenario.
(BZ#790912)
All users are advised to upgrade to these updated packages, which fix
these
bugs. The system must be rebooted for this update to take effect.
複数のバグを修正したカーネルのアップデートパッケージがRed Hatのために利用可能になりました
Enterprise Linux 5に。
カーネルパッケージは、Linuxカーネルは、あらゆるLinuxオペレーティングシステムのコアが含まれてい
システム。
バグ修正:
* CAP_SYS_ADMIN機能を持たないrootユーザーはリセットすることができました
の内容 "を/ proc / sys /カーネル/ dmesg_restrict 0"に設定ファイルを指定します。
その結果、特権のないrootユーザーが保護をバイパスすることができ
ファイルを "dmesg_restrict"とカーネルのリングバッファを読んでください。この更新プログラムは、確実に
CAP_SYS_ADMIN機能を持つrootユーザーだけがへの書き込みを許可されている
ファイルをdmesg_restrict。このファイルへの書き込み上の任意の不正な試みが今失敗した
EPERMエラーが発生した。 (BZ#749246)
時*イーサネット物理トランシーバ(PHYチップ)は、常に電源が投入されました
igbドライバを使用して、ネットワークインターフェイスカード(NIC)が倒された。最近の
変更は、PHYチップなどでパワーダウンされたようにカーネルを修正した
シナリオ。このPHY省電力機能を使用すると、PHYチップは、予期しない可能性
まれにその設定が失われます。その結果、PHYチップは回復しなかった
NICが再接続されていたとNICが育つことができませんでした後。 IGB
ドライバは、NICがある場合のPHYチップがリセットされるようになりましたように変更されました
ネットワークに再接続されている。 igbドライバを使用してNICを次のように育ってい
期待される。 (BZ#786168)
ファイルをアンマウント時にカーネルがdcacheのでdentryを処理する方法*方法
システムは、ディレクトリ?エントリのリストの同時活動を可能にした。リストがあった場合
十分な大きさで、カーネルは、特定の状況下で、NMIによるパニックが
ウォッチドッグのタイムアウトが待っている並行プロセスによって引き起こされる。この更新
特定のプライベートdcacheのリストを使用する基本的な機能を変更する
同時活動が影響を受けれなくなったように、dcacheの上の操作
このシナリオでは。 (BZ#789369)
*概要制御モデル(ACM)ドライバのリストを保護するためにスピンロックを使用しています
USBリクエストブロック(URBs)とドライバによって維持されるバッファを読み取ります。以前は、
USBデバイスは、ACMインターフェース、スケジュールされたACMの間に競合状態を使用したとき
タスクレットが発生する可能性があります。したがって、システムはデッドロックの状況を入力することができます
タスクレットは、割り込み要求を無効にせずにスピンロックを取ることができるので、
(IRQ)を。このような状況はで終わるソフトロックアップの様々な種類の結果
カーネルパニック。このアップデートは、IRQが無効になっているように問題を修正
スピンロックが取得されます。デッドロックが発生しなくなりましたとでカーネルがクラッシュしなく??なりました
このシナリオでは。 (BZ#790778)
のQLogic qla2xxxドライバで*最近の変更は、可能性のあるバグを導入しました
まれな状況下で、システムが応答しなくなる原因となります。この問題
とSAN構成を使用しているシステム上のI / Oエラーリカバリ中に発生した
QLogicファイバチャネルホットバスアダプタ(HBA)。このアップデートではqla2xxxのを修正
システム、ドライバは、もはやこのシナリオでは、ハングアップしません。 (BZ#790907)
tg3ドライバで最近の変化に*があるため、ドライバが使用しようとしました
NICから回復したときに既にソケットバッファ(SKB)へのポインタを解放した
失敗したメモリマッピング。したがって、NICがオフラインになったし、カーネル
パニックが発生しました。このアップデートにより、SKBのポインタは、新しくこのシナリオでは、割り当てられています。
NICは期待どおりに回復し、カーネルパニックが発生しません。また、TG3
ドライバは、特定の状況下で、メモリのフラグメントのマッピングを解除しようとする可能性があり
それがマッピングされていませんでした。その結果、カーネルはパニックが発生しました。この更新プログラムで修正される
付属の "最後"のパラメータを修正することにより、バグを修正しました。 (BZ#790910)
*ファンを持つネットワークインターフェイスカード(NIC)がファンの障害が発生した場合、
PHYチップは、通常、そのファームウェアによってパワーダウンします。以前に、bnx2xドライバ
ノンマスカブルを引き起こす可能性がこれ、正しくファンの障害を処理しませんでした
割り込み(NMI)。したがって、カーネルがクラッシュしたり、パニックになる可能性があります。この更新
適切にファンの障害を処理するためのbnx2xドライバを変更して、NICが現在シャットダウンされ
ダウンが期待どおり、カーネルはこのシナリオではクラッシュしません。 (BZ#790912)
すべてのユーザは、これらの問題を解決する上記アップデートパッケージにアップグレードしてください
バグ。システムを有効にするには、このアップデートを再起動する必要があります。
●PAMについて
【基本】
/etc/pam.d/* : アプリ用の定義ファイルが有るディレクトリ(サービス名のファイル)
/etc/security/* : 各PAMの設定ファイル(PAM名.conf)
/lib/security/* : ライブラリファイルの有る場所
【PAMの動作】
・第一フィールド(ライブラリモジュールのタイプ)
auth : 認証
account : 許可、アカウント管理
password : クレデンシャルの更新
session : ユーザ環境の変更
・第二フィールド(挙動の指定)
required : 成功が必要、失敗時は他モジュールを呼び出すが結果は決まっている
requisite : 失敗時は認証を即終了
sufficient : 成功時は即アクセス許可(他モジュールはバイパス)
optional : 結果を無視
・第三フィールド(モジュール)
/lib/security/$ISA/pam_unix.so :
UNIX認証(古いパスワードは/etc/security/opasswdに保持、履歴管理)
/lib/security/$ISA/pam_env.so : 環境変数の初期設定
/lib/security/$ISA/pam_securetty.so : 危険なターミナルからのrootログイン制限
/lib/security/$ISA/pam_stack.so : 他のPAMを呼び出す
/lib/security/$ISA/pam_nologin.so :
/etc/nologin(中味は空でも)があればroot以外ログイン拒否
/lib/security/$ISA/pam_deny.so : 常に失敗
/lib/security/$ISA/pam_console.so : コンソールユーザへの特権
/lib/security/$ISA/pam_access.so : 場所ベースのアクセス管理
/lib/security/$ISA/pam_listfile.so : ファイルベースのアクセス管理
/lib/security/$ISA/pam_cracklib.so : パスワードの辞書チェック
/lib/security/$ISA/pam_tally.so :
失敗ログイン履歴を/var/log/faillogに保存。ロックも可能
/lib/security/$ISA/pam_cracklib.so :
パスワード基準の指定
【共通の設定】
・下記ファイルで共通設定
/etc/pam.d/system-auth
【使用例】
・パスワードの制限
1:/etc/pam.d/system-authのpam_crackilb.soとpam_unix.soを編集
password required pam_cracklib.so \ :
通常は1行で、"\"は改行しても続くよって意味
minlength=20 \ : パスワードの最低長
ocredit=5 \ : 特殊文字5つ以上いれろ
dcredit=5 \ : 数字
ucredit=5 \ : 大文字
lcredit=5 : 小文字
password required pam_unix.so \
nullok md5 authtok \ : ノンパスOK、暗号化
remember=5 : 5つまでパスワードを憶える
■ルートユーザのログイン拒否(su時のみ可能)
1:loginの制限(先頭行に追加)
#vi /etc/pam.d/login
auth required pam_listfile.so item=user sense=deny
file=/etc/security/listfile onerr=succeed
2:gdmの制限(グラフィカルログイン)
#vi /etc/pam.d/gdm
auth required pam_listfile.so item=user sense=deny
file=/etc/security/listfile onerr=succeed
3:制限ファイルの作成(拒否ユーザの列挙)
#vi /etc/security/listfile
root
■testグループユーザのサービスアクセスを1つの仮想コンソールに限定
1:下記ファイルの最後に記述。testグループはtty1を除く全てを拒否
#vi /etc/security/access.conf
-:test:ALL EXCEPT tty1
2:全てのサービスに適用(authではじまる行の次に追加)
#vi /etc/pam.d/system-auth
account required /lib/security/$ISA/pam_access.so
■コンソールユーザの端末停止、再起動を禁止する
1:以下のファイルのpam_console.soをコメントアウトする
/etc/pam.d/halt
/etc/pam.d/reboot
/etc/pam.d/poweroff
#auth required pam_console.so