Ini adalah bash script sederhana saya menulis untuk memperbaiki hak akses dan kepemilikan file dalam akun cpanel. Untuk menggunakan, cukup salin script server Anda, chmod 755,
1 |
sh fixperms.sh user1 user2 user3 |
Di bawah ini adalah script, simpan dengan nama fixperms.sh
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
#!/bin/bash # Script to fix permissions of accounts # Written by: Vanessa Vasile 5/13/10 # http://thecpaneladmin.com if [ "$#" -lt "1" ];then echo "Must specify user" exit; fi USER=$@ for user in $USER do HOMEDIR=$(egrep "^${user}:" /etc/passwd | cut -d: -f6) if [ ! -f /var/cpanel/users/$user ]; then echo "$user user file missing, likely an invalid user" elif [ "$HOMEDIR" == "" ];then echo "Couldn't determine home directory for $user" else echo "Setting ownership for user $user" chown -R $user:$user $HOMEDIR chmod 711 $HOMEDIR chown $user:nobody $HOMEDIR/public_html $HOMEDIR/.htpasswds chown $user:mail $HOMEDIR/etc $HOMEDIR/etc/*/shadow $HOMEDIR/etc/*/passwd echo "Setting permissions for user $USER" find $HOMEDIR -type f -exec chmod 644 {} \; -print find $HOMEDIR -type d -exec chmod 755 {} \; -print find $HOMEDIR -type d -name cgi-bin -exec chmod 755 {} \; -print find $HOMEDIR -type f \( -name "*.pl" -o -name "*.perl" \) -exec chmod 755 {} \; -print chmod 750 $HOMEDIR/public_html if [ -d "$HOMEDIR/.cagefs" ]; then chmod 775 $HOMEDIR/.cagefs chmod 700 $HOMEDIR/.cagefs/tmp chmod 700 $HOMEDIR/.cagefs/var chmod 777 $HOMEDIR/.cagefs/cache chmod 777 $HOMEDIR/.cagefs/run fi fi done |
selamat untuk mencoba