目次 |
※例としてユーザー名をsudachiとする
[root@host2 ~]# useradd sudachi ← 一般ユーザー追加 [root@host2 ~]# passwd sudachi ← 一般ユーザーパスワード設定 Changing password for user sudachi. New password: ← 一般ユーザーパスワード応答 Retype new password: ← 一般ユーザーパスワード応答(確認) passwd: all authentication tokens updated successfully. [root@host2 ~]# chmod 711 /home/sudachi/
← 一般ユーザーのホームディレクトリのパーミッション変更
[root@host2 ~]# chroot-useradd sudachi ← 一般ユーザー追加 Changing password for user sudachi. New UNIX password: ← 一般ユーザーパスワード応答 Retype new UNIX password: ← 一般ユーザーパスワード応答(確認) passwd: all authentication tokens updated successfully. [root@host2 ~]# chmod 711 /home/sudachi/
← 一般ユーザーのホームディレクトリのパーミッション変更
※以降、SSHによるリモート接続もできるWebユーザーを追加する場合はこの手順で行う
※例としてユーザ名をsudachiとする
[root@host2 ~]# useradd -s /sbin/nologin sudachi ← 一般ユーザー追加 [root@host2 ~]# passwd sudachi ← 一般ユーザーパスワード設定 Changing password for user sudachi. New password: ← 一般ユーザーパスワード応答 Retype new password: ← 一般ユーザーパスワード応答(確認) passwd: all authentication tokens updated successfully. [root@host2 ~]# chmod 711 /home/sudachi/ ← 一般ユーザーのホームディレクトリのパーミッション変更
[root@host2 ~]# chroot-useradd sudachi /sbin/nologin ← 一般ユーザー追加 Changing password for user sudachi. New UNIX password: ← 一般ユーザーパスワード応答 Retype new UNIX password: ← 一般ユーザーパスワード応答(確認) passwd: all authentication tokens updated successfully. [root@host2 ~]# chmod 711 /home/sudachi/ ← 一般ユーザーのホームディレクトリのパーミッション変更
※以降、SSHによるリモート接続はできないWebユーザーを追加する場合はこの手順で行う
ドキュメントルート、エイリアス等の変更です。
# vi /etc/httpd/conf.d/DocumentRoot.conf ・・・・・ # /etc/rc.d/init.d/httpd reload
※例としてユーザー名をsudachiとする
[root@host2 ~]# useradd -s /sbin/nologin sudachi ← ユーザー追加 [root@host2 ~]# passwd sudachi ← パスワード設定 Changing password for user sudachi. New UNIX password: ← パスワード応答 Retype new UNIX password: ← パスワード応答(確認) passwd: all authentication tokens updated successfully.
※例としてユーザ名をsudachiとする
[root@host2 ~]# useradd sudachi ← ユーザ追加 [root@host2 ~]# passwd sudachi ← パスワード設定 Changing password for user sudachi. New UNIX password: ← パスワード応答 Retype new UNIX password: ← パスワード応答(確認) passwd: all authentication tokens updated successfully.
※同じサーバー内でのメール転送設定です。
[root@host2 ~]# echo sns: webmaster >> /etc/aliases [root@host2 ~]# newaliases ← メール転送設定反映
※例として一般ユーザー名をsudachiとする
[root@host2 ~]# useradd sudachi ← 一般ユーザーの作成 [root@host2 ~]# passwd sudachi ← ユーザーパスワード設定 Changing password for user sudachi. New UNIX password: ← ユーザーパスワード応答 Retype new UNIX password: ← ユーザーパスワード応答(確認) passwd: all authentication tokens updated successfully.
ホームディレクトリより上層へのアクセスを禁止するユーザー(ここではsudachiとする)の作成
[root@host2 ~]# chroot-useradd sudachi ← ユーザー作成 Changing password for user sudachi. New UNIX password: ← ユーザーパスワード応答 Retype new UNIX password: ← ユーザーパスワード応答(確認) passwd: all authentication tokens updated successfully.
例として、管理者用の一般ユーザー名をsudachiとする
[root@host2 ~]# usermod -G wheel sudachi ← 管理者ユーザーをwheelグループに追加
※例として一般ユーザー名をsudachiとする
[root@centos ~]# userdel -r sudachi ← ユーザーsudachiの削除
[root@host2 ~]# halt ← システム停止する場合 [root@host2 ~]# reboot ← システム再起動する場合
バックアップからディレクトリ単位、ファイル単位でリストア(復元)する。
[root@host2 ~]# tar jxvfP /backup/backup.tar.bz2 /home/yuzu/public_html/index.php ← ファイル復元 /home/yuzu/public_html/index.php
[root@host2 ~]# tar jxvfP /backup/backup.tar.bz2 /home/yuzu/public_html ← ディレクトリ復元 /home/yuzu/public_html/ /home/yuzu/public_html/index.php
[root@host2 ~]# ll /home/yuzu 合計 60 ・・・・ drwxr-xr-x 15 yuzu yuzu 4096 4月 9 15:37 public_html ・・・・ ↑ ディレクトリがパーミッション、所有者も含めて復元されてる
[root@host2 ~]# ll /home/yuzu/piblic_html/ 合計 1 ・・・・ -rw-rw-r-- 1 yuzu yuzu 3478 11月 10 04:47 index.php ・・・・ ↑ ファイルがパーミッション、所有者も含めて復元されてる
[root@host2 ~]# /bin/cp -Rf /backup/mysql/yuzu/ /var/lib/mysql/ ← バックアップよりyuzuデータベースをコピー [root@host2 ~]# chown -R mysql:mysql /var/lib/mysql/yuzu/ ← yuzuデータベースの所有者をmysqlに変更 [root@host2 ~]# chmod 700 /var/lib/mysql/yuzu/ ← yuzuデータベースのパーミッションを700に変更 [root@host2 ~]# chmod 660 /var/lib/mysql/yuzu/* ← yuzuデータベース内データのパーミッションを660に変更
mysqldumpのバックアップは、SQLベースのバックアップが可能です。存在するデータをすべてSQLにしてテキスト形式に保存できます。
[root@host2 ~]# mysqldump -u root -x --all-databases > dump.sql
これですべてのデータベースのバックアップが可能です。
特定のデータベースのみのバックアップの場合は、
[root@host2 ~]# mysqldump -u root データベース名 > dump.sql
としてバックアップ可能です。
mysqldumpのすべてのデータベースのバックアップを復元するには、
[root@host2 ~]# mysql -u root -p < dump.sql
のように、mysqlクライアントにファイルの内容をリダイレクトしてあげるだけです。
特定データベースのみの復元は
[root@host2 ~]# mysql -u root データベース名 < dump.sql
のようにします。