Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm installing SSL certificate on a VPS server. I need to make it only readable by the root. How can I do this?

share|improve this question

migrated from Aug 19 '12 at 5:05

This question came from our site for professional and enthusiast programmers.

There'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 5:35
If 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

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.

share|improve this answer

Have you tried doing chmod 0400 <your-file-here>?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.