💻

パーミッションの一括変更

2021/02/02に公開

sshなどでログイン後に、各サーバー内のディレクトリ・ファイルを一括でパーミッション変更したい場合があります。
以下の方法で可能です。

// ディレクトリ
find ./* -type d -exec chmod 0705 {} +
// ファイル
find ./* -type f -exec chmod 0644 {} + 

代表的なレンタルサーバーだと以下のような感じで出来ると思います。

Xserver
https://www.xserver.ne.jp/manual/man_server_permission.php

// ディレクトリ
find ./* -type d -exec chmod 0705 {} +
// ファイル
find ./* -type f -exec chmod 0644 {} +

さくらレンタルサーバー
https://help.sakura.ad.jp/206206041/

// ディレクトリ
find ./* -type d -exec chmod 0755 {} +
// ファイル
find ./* -type f -exec chmod 0705 {} +

ロリポップ、ヘテムル
https://lolipop.jp/manual/hp/permission/
https://support.heteml.jp/hc/ja/articles/360042135454-CGI-SSI-PHP-sendmail

// ディレクトリ
find ./* -type d -exec chmod 0705 {} +
// ファイル
find ./* -type f -exec chmod 0604 {} +

Discussion