Friday, January 7, 2022

[SOLVED] Can't cat a public read file

Issue

Having the following file:

-rw-r--r-- 1 root root 887 Aug 25 13:18 /etc/ssl/private/livereload.key

Can't manage to read it from a regular user instance.

$ cat /etc/ssl/private/livereload.key
cat: /etc/ssl/private/livereload.key: Permission denied

I was wandering why since the file seems to be public for reading.
Did I miss-set something when I generated the file ?


Solution

default permissions are as below on /etc/ssl. So others can not read this directory. root user or group member of ssl-cert can only read this file, if default permissions not been changed.

ls -alrt /etc/ssl/
drwx--x---   2 root ssl-cert  4096 Dec 19  2014 private


user@host:/etc/ssl$ cd /etc/ssl/private/
bash: cd: /etc/ssl/private/: Permission denied

you can use this;

sudo cat /etc/ssl/private/livereload.key


Answered By - Mustafa DOGRU