2010/02/20

ntpサーバで時刻同期設定

ntpで時刻設定することがあったので、メモ。


1.ntpをインストール
 yum install -y ntp

2.時刻をサーバに問い合わせて同期
 ntpdate ntp.nict.jp (※このntp.nict.jpは日本標準時プロジェクトのntpサーバです。)

3.ntpの設定ファイルを変更
 vim /etc/ntp.conf

 server 0.centos.pool.ntp.org
 server 1.centos.pool.ntp.org
 server 2.centos.pool.ntp.org

 上記の箇所を下記に変更

 server -4 ntp.nict.jp
 server -4 ntp1.jst.mfeed.ad.jp
 server -4 ntp2.jst.mfeed.ad.jp

 ※VPSとかだと、変更権限が無いかも…

4.ntpdの起動
 /etc/init.d/ntpd start

5.自動起動の設定
 chkconfig ntpd on

6.ntpdのステータス確認
 ntpq -p

2010/02/17

不正ユーザーでのアクセス回数

CentOS5系で不正ユーザーでのアクセス回数を表示してみた。。。

cat /var/log/secure* | grep 'Invalid' | awk '{print $8}' |sort | uniq -c | sort -nr | head -n 100

こんなにアタックが…

2010/02/11

メールサーバー切替え(CentOS5.4)

システムで使用するメールサーバー機能をsendmailからPostfixに切替えます。
root権限で、下記のコマンドを実行

 alternatives --config mta


 There are 3 programs which provide 'mta'.

  Selection Command
 -----------------------------------------------
  1 /usr/sbin/sendmail.sendmail
 *+ 2 /var/qmail/bin/sendmail
  3 /usr/sbin/sendmail.postfix

 Enter to keep the current selection[+], or type selection number: 3

 ・sendmail自動起動設定解除
  chkconfig sendmail off

 ・sendmail自動起動設定解除確認(ランレベル確認)
  chkconfig --list sendmail
  sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off

 ・Postfix自動起動設定
  chkconfig postfix on

 ・Postfix自動起動設定確認(ランレベル確認)
  chkconfig --list postfix
  postfix 0:off 1:off 2:on 3:on 4:on 5:on 6:off

2010/02/10

一般ユーザーが自身のホームディレクトリ以外を参照できないようにする

管理者用ユーザー(wheelグループ所属ユーザー)を除いて、一般ユーザーが自身のホームディレクトリ以外を参照できないようにする。

[root@fedora ~]# usermod -G wheel fedora ← 管理者ユーザー(例:fedora)をwheelグループに追加

[root@fedora ~]# vi /etc/ssh/sshd_config ← SSHサーバー設定ファイル編集
以下を最終行へ追加
Match Group *,!wheel
ChrootDirectory /home/%u/./

2010/02/07

「eclipse」でハマッタ履歴(!MESSAGE 始動エラー)

eclipseの更新作業をしたら、起動時にポップアップが表示され、
eclipseが起動出来なくなりました。

そのポップアップに記載されていた、ログを見ると下記の内容が記載されていました。

■修正方法
 1.コマンドプロンプト(OSがVistaの場合、)管理者にて起動します。
 2.c:\work\eclipse.exe -clean コマンドを実行します。
   [c:\work\]はお使いの環境に合わせて下さい。
 3.上記2のコマンドを実行すると、eclipseが起動します。

いやー突然使えなくなるのでビックリしました。。。



!SESSION 2010-02-07 14:42:26.842 -----------------------------------------------
eclipse.buildId=M20090917-0800
java.version=1.6.0_17
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=ja_JP
Framework arguments: -product org.eclipse.epp.package.php.product
Command-line arguments: -os win32 -ws win32 -arch x86 -product org.eclipse.epp.package.php.product

!ENTRY org.eclipse.osgi 4 0 2010-02-07 14:42:27.587
!MESSAGE 始動エラー
!STACK 1
java.lang.NoSuchMethodError: org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.publishServiceEvent(Lorg/osgi/framework/ServiceEvent;)V
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl.register(ServiceRegistrationImpl.java:129)
at org.eclipse.osgi.internal.serviceregistry.ServiceRegistry.registerService(ServiceRegistry.java:206)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:506)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.registerService(BundleContextImpl.java:524)
at org.eclipse.core.runtime.adaptor.EclipseStarter.publishSplashScreen(EclipseStarter.java:539)
at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:291)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
!SESSION Sun Feb 07 14:42:27 JST 2010 ------------------------------------------
!ENTRY org.eclipse.equinox.launcher 4 0 2010-02-07 14:42:27.624
!MESSAGE Exception launching the Eclipse Platform:
!STACK
java.lang.NullPointerException
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.readStateData(BaseStorage.java:749)
at org.eclipse.osgi.internal.baseadaptor.BaseStorage.getStateManager(BaseStorage.java:704)
at org.eclipse.osgi.baseadaptor.BaseAdaptor.getState(BaseAdaptor.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.logUnresolvedBundles(EclipseStarter.java:443)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:189)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514)
at org.eclipse.equinox.launcher.Main.run(Main.java:1311)