Last update at :2024-06-15,Edit by888u
Although we have more freedom when building a website on a VPS than a website, we need to do the security settings of the space ourselves. Once the website space or web page is insecure, it may affect other websites through privilege escalation. Of course, I don’t know much about specific security snails. Mainly because I encountered a problem this morning. Since the transferred website files all have 777 permissions, and then moved to the host, it results in a 403 error message. This requires us to set 755 for all folders and 644 for all web files. Can be solved.
Many people will find that it is very troublesome to set it up manually, because there are folders and files under each folder. Is there a command that can be set directly?
SSH command method 1
find . -exec sh -c \\\"if [[ -d \\\"{}\\\" ]]; then chmod 755 \\\"{}\\\"; else chmod 644 \\\" {}\\\"; fi \\\" \\\\;SSH command method 2
find ./ -type d -print|xargs chmod 755;find ./ -type f -print |xargs chmod 644Through any of the above methods, you can solve the problem of setting folder 755 and web page file permissions 644.
Recommended site searches: Korean proxy server, Mainland China registration-free space, Western digital registration, free proxy IP, windows virtual host, Hong Kong space, vps dynamic IP, what is the domain name server, overseas host, cloud virtual host,
p>
发表评论