I'm installing SSL certificate on a VPS server. I need to make it only readable by the root. How can I do this?
Asked
Active
Viewed 285 times
-1
-
4There's no reason to protect the certificate. The server will send the certificate to anyone who asks for it anyway. It's the private key you need to protect. – David Schwartz Aug 19 '12 at 05:35
-
1If you don't know how to set the permissions on a file why are you even on a server? Please do everyone a favour and seek professional assistance. – John Gardeniers Aug 19 '12 at 10:27
2 Answers
3
As root:
# chown root cert.key
# chmod 600 cert.key
where cert.key is the filename.
The first command makes sure root is the owner of the file.
The three numbers in the chmod command correspond to the permissions for the user (root, in this case), group, and everybody else, respectively. The permission values are 4 for reading, 2 for writing, and 1 for executing. In this case, the chmod command gives root permission to read and write the file (4 + 2 = 6), and nobody else permission to do anything.

Jim Garrison
- 131
- 2