シスメモ

Linux(CentOS)、Windows(サーバー/クライアント)、Yamaha RTX、その他の技術メモ

CentOS Linux

さくらのVPS(CentOS5)初期設定メモ

投稿日:

さくらのVPSで初期設定を行った際のメモです。

■1. rootパスワード変更
コマンド:passwd

■2.ユーザー作成
コマンド:useradd hogehoge
コマンド:passwd hogehoge

■3.ユーザーのwheelグループへの追加
コマンド:usermod -G wheel hogehoge

vi /etc/pam.d/su
#auth required pam_wheel.so use_uid

auth required pam_wheel.so use_uid

■4.SSH設定
コマンド:vi /etc/ssh/sshd_config

・PermitRootLoginをNoに変更
・Port:10022に変更

■5.ファイアウォール設定
・/usr/local/sbin/iptables-init.shを以下の内容で作成する
====================================================
#!/bin/sh

iptables -F
iptables -X

iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -P FORWARD DROP

iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

iptables -A INPUT -s 10.0.0.0/8 -j DROP
iptables -A INPUT -s 172.16.0.0/12 -j DROP
iptables -A INPUT -s 192.168.0.0/16 -j DROP

#SSH, SMTP, LDAP
iptables -A INPUT -m state –state NEW -p tcp -s XXX.XXX.XXX.XXX –dport 10022 -j ACCEPT #SSH
iptables -A INPUT -m state –state NEW -p tcp –dport 25 -j ACCEPT #SMTP
iptables -A INPUT -m state –state NEW -p tcp -s XXX.XXX.XXX.XXX –dport 389 -j ACCEPT #LDAP
iptables -A INPUT -m state –state NEW -p tcp -s XXX.XXX.XXX.XXX –dport 636 -j ACCEPT #LDAPS

iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT
===================================================
・chmod+xで実行権限付与
・/usr/local/sbin/iptables-init.shを実行
・iptables -L で設定内容確認
・iptables-save で/etc/sysctl/iptablesに設定内容が反映される

■6.不要サービスの停止
/sbin/chkconfig auditd offv
/sbin/chkconfig autofs off
/sbin/chkconfig avahi-daemon off
/sbin/chkconfig bluetooth off
/sbin/chkconfig cups off
/sbin/chkconfig firstboot off
/sbin/chkconfig gpm off
/sbin/chkconfig haldaemon off
/sbin/chkconfig hidd off
/sbin/chkconfig iscsi off
/sbin/chkconfig iscsid off
/sbin/chkconfig isdn off
/sbin/chkconfig ip6tables off
/sbin/chkconfig kudzu off
/sbin/chkconfig lvm2-monitor off
/sbin/chkconfig mcstrans off
/sbin/chkconfig mdmonitor off
/sbin/chkconfig messagebus off
/sbin/chkconfig netfs off
/sbin/chkconfig nfslock off
/sbin/chkconfig pcscd off
/sbin/chkconfig portmap off
/sbin/chkconfig rawdevices off
/sbin/chkconfig restorecond off
/sbin/chkconfig rpcgssd off
/sbin/chkconfig rpcidmapd off
/sbin/chkconfig sendmail off
/sbin/chkconfig smartd off
/sbin/chkconfig xfs off
/sbin/chkconfig yum-updatesd off



-CentOS, Linux
-, ,

執筆者:


comment

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

関連記事

BackWPupで"Connection time-out" The HTTP response test get a false http status ()

photo credit: Peregrino Will Reign via photopin cc WordPressのバックアップとしてBackWPupを使い始めたのですが、ジョブ作成後のバックア …

/etc/passwd,/etc/groupだけでなく、LDAPのユーザー、グループも表示させる場合のコマンド

photo credit: *n3wjack’s world in pixels via photopin cc ■/etc/passwd,/etc/groupだけでなく、LDAPのユーザ …

CentOS6.4にZabbix 2.0.6をインストール

photo credit: cdamian via photopin cc CentOS6.4にzabbix 2.0.6 をYUMからインストールします。 ※Apache/PHP/MySQLがインスト …

zabbix2.0で「zabbixサーバが動作していません」と表示される

  zabbixのインストール後、「zabbixサーバが動作していません」と表示されるようになりました。 (画面をリロードしても、しばらくするとまた表示される) Zabbixサーバのプロセス …

CentOS6のcrontab

photo credit: hetaru via photopin cc ■CentOS6のcrontabについて centos6でcentos5以前のようにジョブを定時に実行するには、「cronie …