Key file permissions are not correct, should be 600 or 660 instead of 644 How can I solve this?
4 Answers
As @avigil and @IliaRostovtsev mentioned on their answers. You have to change the file permisions to 600 or 660 with this instruction:
chmod 600 /filepath
or
chmod 660 /filepath
Why 600 or 660 instead of 644 permissions? Becase:
644 permission means: I (owner) can change it, everyone else can read it.
600 permission means: I (owner) can write and read the file, everyone else can't.
660 permission means: I (owner) can write and read the file. Group members can write and read the file. Everyone else not mentioned above can't.
600 and 660 permissions will add an extra level of security to your files because you won't let "everyone" to read or write on your files
If you have Windows and have trouble with laravel you can check these 2 links which fix this problem:

- 518
- 4
- 12
-
C:\>chmod 600 \www\laravel\aapiVeiculos\storage\oauth-public.key 'chmod' is not recognized as an internal or external command, operable program or batch file. – Luska Zimmermann Feb 11 '18 at 20:50
-
@DecepcionadoZimmermann are you using windows? – Art_Code Feb 11 '18 at 20:52
-
@DecepcionadoZimmermann I suggest you to see this link: [Passport laravel](https://github.com/laravel/passport/issues/453) – Art_Code Feb 11 '18 at 20:58
-
Thanks, works like a charm, @DecepcionadoZimmermann I believe it's a correct answer – Moe Far Nov 24 '18 at 09:36
-
@MoeFar I'm glad it was usefull. Have a nice day – Art_Code Nov 26 '18 at 17:58
-
1thank you it also worked for Drupal 8. – StefanSpeterDev May 28 '20 at 10:00
-
@StefanYYC Sorry to answer late. I'm glad it was useful for you too! – Art_Code Aug 28 '20 at 19:46
Setting needed permissions by running in the console on the required file:
chmod 600 /path/to/the/file

- 13,086
- 11
- 53
- 88
-
C:\>chmod 600 \www\laravel\aapiVeiculos\storage\oauth-public.key 'chmod' is not recognized as an internal or external command, operable program or batch file. – Luska Zimmermann Feb 11 '18 at 20:50
-
-
-
You should take a look here then: https://stackoverflow.com/questions/5264595/windows-chmod-600 – Ilia Ross Feb 13 '18 at 12:43
You should be able to just do: sudo chmod 660 filename

- 1,028
- 6
- 14
-
if permissions are 644 and he is owner the `sudo` should not be necessary – avigil Feb 11 '18 at 16:59
-
Never hurts to use sudo when running a chmod, that way you ensure that whoever reads the answer doesn't get yet another error regarding permissions – Alex Dovzhanyn Feb 11 '18 at 17:03
-
1Probably safer to `sudo chown $(whoami) filename` first in that case, since `sudo chmod 660` on a file not owned by the current user will still cause permissions issues later – avigil Feb 11 '18 at 17:07
-