I have some files inside a folder with various formats like .txt
, .pem
, .csv
and .json
.
I want only sudo/root to be able access them. I have done
chmod 700
and
chmod 600
on each of those files. But, I can still print the private key of my .pem
files by doing cat
on terminal without sudo privileges and open .json
files from the file system in "gedit".
What has gone wrong? How do I not let anyone access the contents of those files?
Suppose your file is named
example.txt
. Then:should do the job.
If you want an entire directory
exampledir
to be accessible only to root:Make sure that the owner of the file is root and set the permissions.
Eg filename 'test.txt'
Run the following command