Problem with default file permission. Something is overriding umask setting
My server uses CENTOS 6. (I am upgrading to 7 this next weekend)
When I use Filezilla (SFTP) to upload php scripts the permission is set to 664 and the script cannot be used until I change the permission to 644. I do not think that Filezilla is the problem.
Using SSH I confirmed that umask = 022, which is correct.
Since that umask setting should result in the desired file permission of 644 there must be a setting somewhere that is overriding the system umask setting.
I downloaded /etc/profile and saw these lines:
if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
umask 002
else
umask 022
fi
I changed unmask 002 to 022, uploaded the profile and restarted my server.
That had no effect. PHP files that I upload still get a permission of 664 which is wrong.
Where else should I look to find whatever is overriding the system umask?
I am still a bit of a novice admin so please do not be too cryptic with any advice.
-
What if you upload the files using FTPS or FTP? How about uploading the files via cPanel File Manager? permissions are okay then? 0 -
Not sure how to get the "Solved" tag on my post. Here is the solution that worked for me. Edit the file /etc/ssh/sshd_config I changed this line Subsystem sftp /usr/libexec/openssh/sftp-server to Subsystem sftp /usr/libexec/openssh/sftp-server -u 022 Note the umask setting. 0 -
I'm glad you were able to get that resolved. We add the "Solved" tag on our end, so I'll add that for you now :D 0
Please sign in to leave a comment.
Comments
3 comments