Tips記事
» 2002年09月18日 22時04分 UPDATE

設定ファイルを大幅に編集する時はバックファイルを作ろう

[木田佳克,ITmedia]

 Linuxのインストール直後の状態を見れば、さまざまなデーモンやツールの設定ファイルがあらかじめ用意されていることが分かる。これらのファイルに何らかの編集を行う際、拡張子「.org」などを付加させて保存しておくのが好ましい。

 バックアップファイルを作成しておけば、diffコマンドを利用して差分個所を手軽に把握することが可能だ。

# diff sshd_config.org sshd_config
27c27
< X11Forwarding yes
---
> X11Forwarding no
9c9
< Protocol 2,1
---
> Protocol 1,2
27c27
< X11Forwarding yes
---
> X11Forwarding no
45c45
< RSAAuthentication no
---
> RSAAuthentication yes
48,49c48,49
< PasswordAuthentication yes
< PermitEmptyPasswords yes
---
> PasswordAuthentication no
> PermitEmptyPasswords no

 上記では例として「sshd_config」ファイルの差分例を挙げた。コマンド指定下に表示されている「---」で区切られた上段がオリジナルファイルの記述、下段が変更後の記述内容である。

Copyright © ITmedia, Inc. All Rights Reserved.

注目のテーマ