2013年1月6日日曜日

sshのrootログイン無効設定

vi /etc/ssh/sshd_config PermitRootLogin no コメントアウトしてyesをnoに変更 sshdを再起動 /etc/init.d/sshd restart  sshには次回よりユーザでログインする。 su - コマンドでroot権限が取れる。



ftpユーザ・ディレクトリ制限

rootにて
vi /etc/vsftpd/vsftpd.conf
12行目:anonymous_enable=NOに変更 96,97行目:コメント解除(chroot有効) 99行目:コメント解除(chroot_listを指定)
最終行追記:local_root=/var/www/
:wq


上書き保存する。 これ大事↓ 
vi /etc/vsftpd/chroot_list
そして とりあえずはなにも入力せずに:wqで保存 最後にsshdの再起動
/etc/init.d/vsftpd restart


こうすると/var/wwwより上には接続できません。 ドキュメントルートは/var/www/html/なので、ブラウザからはアクセスできません。 FTPを自分以外に渡す必要性があるときにも便利ですし、特定ファイルをFTPでしか見れないような形にする意味でも便利



サブドメイン設定

httpd.confに一番下、書き加える
<VirtualHost *>

ServerName test.example.net 追加するサブドメイン

DocumentRoot /var/www/html/cafe1 そのデータのディレクトリ

</VirtualHost>
httpdを再起動 DNSのレーコード設定して終了

初期設定

yum install wget
yum install httpd php mysql-server php-mysql php-mbstring php-gd
yum install php-xml
/etc/init.d/httpd start
chkconfig httpd on
/etc/init.d/mysqld start
mysqladmin -u root password '任意のパスワード'
[root@web05 ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.1.66 Source distribution Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | test | +--------------------+ 3 rows in set (0.00 sec) mysql>exit;
 yum install vsftpd
chkconfig vsftpd on
phpMyAdminのインストール
wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
rpm --import RPM-GPG-KEY-EPEL-6
rm -f RPM-GPG-KEY-EPEL-6
vi /etc/yum.repos.d/epel.repo
[epel] name=EPEL RPM Repository for Red Hat Enterprise Linux baseurl=http://ftp.riken.jp/Linux/fedora/epel/6/$basearch/ gpgcheck=1 enabled=0
yum --enablerepo=epel install phpmyadmin
<Directory /usr/share/phpMyAdmin/> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> Require ip 127.0.0.1 Require ip ::1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 Order Deny,Allow Deny from All Allow from 127.0.0.1 Allow from All Allow from ::1 </IfModule> </Directory>
/etc/init.d/httpd restart
ディレクティブ1:ServerTokensの設定 設定方法 httpd.confの Section 1 Global Environment項目の中にある ServerTokens OS 部分をコメントアウトし、すぐ下に「ServerTokens ProductOnly」を追加します。
vi /etc/httpd/conf/httpd.conf
/etc/init.d/httpd restart
chkconfig --list|grep -E "httpd|mysql|vsftpd"
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off vsftpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
yum install unzip