Rene Kita's weblog

Blog About RSS Links

Wrong permissions on jekyll site files

Problem

If you changed your default umask from 022 to something more strict and get Error 403 for your website after putting your _site's files via ftp:

Your file permissions are not what the need to be for your webserver.

Solution

Remove the _site directory:

	rm -r _site
Build your site with:
	(umask 022 && jekyll build)
Using jekyll serve here worked not as anticipated, so I'll stick with removing _site after using serve.

---- Update 2019-07-29 21:41:13 +0200

What a mess! What I said above is not always sufficient, files in pages or _includes are not affected by the jekyll build. Those files seem to be just copied with their original permissions. To find all files with wrong permissions, go to the directory you want to check and do

	find \! -perm 644 -type f -o \! -perm 755 -type d
Directories need 755 and files need 644. To automatically change permissions you need two steps:
	find \! -perm 644 -type f -exec chmod 644 {} \;
	find \! -perm 755 -type d -exec chmod 755 {} \;

Last modified: 2018-12-27T00:00:00Z