Author Topic: สคิป find folder then chmod folder 755 and file 644 in wordpress  (Read 1503 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
สคิป find folder then chmod folder 755 and file 644 in wordpress
« on: ธันวาคม 29, 2022, 07:31:30 AM »
===สคิป find folder then chmod folder 755 and file 644 in wordpress
find /home/wordpress/htdocs \
\( -type f -exec chmod ug+rw,o+r {} \; \) , \
\( -type d -exec chmod ug+rwxs,o+rx {} \; \)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: สคิป find folder then chmod folder 755 and file 644 in wordpress
« Reply #1 on: ธันวาคม 29, 2022, 07:43:00 AM »
==== อีกตัวอย่าง จะทำการเปลี่ยน folder หลักและ sub-folder ภายใน folder หลักด้วย =====
find /home/test/public_html/wp-admin -type d -exec chmod 755 {} \;
หรือจะ
cd /home/test/public_html/wp-admin
find . -type d -exec chmod 755 {} \;

To change all the files to 644 (-rw-r--r--):
find /opt/lampp/htdocs -type f -exec chmod 644 {} \;

Some splainin': (thanks @tobbez)

chmod 755 {} specifies the command that will be executed by find for each directory
chmod 644 {} specifies the command that will be executed by find for each file
{} is replaced by the path
; the semicolon tells find that this is the end of the command it's supposed to execute
\; the semicolon is escaped, otherwise it would be interpreted by the shell instead of find