chmod 755 to 644

asishlla

Verified User
Joined
Jul 24, 2009
Messages
235
hello
which command i need to chmod 755 to 644 in all of my custmers account in my server via ssh?
command for files to Set permissions 644
command for directory to Set permissions 755
this?:
find -type f -exec chmod 644 {} \;
find -type d -exec chmod 755 {} \;
is that it?
thanks
 
try........
find /home/*/domains/*/public_html -type d -print0 | xargs -0 chmod 711

find /home/*/domains/*/public_html -type f -print0 | xargs -0 chmod 644

cd /usr/local/directadmin/data/users && for i in `ls`; do { chown -R $i:$i /home/$i/domains/*/public_html;}; done;
 
find /home/*/domains/*/public_html -type f -exec chmod 644 {} \;
find /home/*/domains/*/public_html -type d -exec chmod 755 {} \;
 
At the risk of duplicating a topic, I've hit a snag with the restoration of 500 accounts.
The problem is that the /home/user/domains is showing with 710 instead of 711.

How do I go about changing it to 711 throughout?

chmod 711 /home/*/domains ?

I need to change just this specific domains/ directory, non of the other directories.

This is due to the secure_access_group=access feature that I ran.

Am I correct about the code or do I need to change it to something else?

Thanks,

-Alon.
 
Try this bash script. I haven't tested it, but it should work...

Code:
#!/bin/bash
for username in `/bin/ls /home`; do
  if [ -d /home/$username/domains ]; then
    for domain in `/bin/ls /home/$username/domains`; do
      if [ -d /home/$username/domains/$domain/public_html ]; then
        /bin/chown -R $username:$username /home/$username/domains/$domain/public_html
        /bin/chmod -R 755 /home/$username/domains/$domain/public_html
      fi
    /bin/echo "Fixed ownership and permissions for $domain"
    done
  fi
done
/bin/echo "Fixed ownership and permissions for all sites."
exit 0;
 
My first question is:

What do you have as a permission setting for the /home/user/domains on your system?

Is it currently showing 710? 711? or 755?

Mind you, while the script czotos provided (thank you for the contribution) is comprehensive in going down to the public_html, I do not have an issue/problem with public_html, just the /home/user/domains .
I'm reluctant to run a deep directory change as it may conflict with user's own changed of permission for their public_html files/dirs (images/ usually asks for 777).

So,. my first order of questions starts with "what should be in the /home/user/domains" specifically, as just changing that directory permission, immediatly solves my "Forbidden" on the websites (even for index.html files).

-Alon.
 
Please understand that my bash script above can be modified to suit your needs... Simply make the necessary changes.
 
Back
Top