Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 stackoverflow.com Aug 19 '12 at 5:05

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

    
what have you tried –  NullPoiиteя Aug 19 '12 at 5:06
4  
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
1  
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

2 Answers 2

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

share|improve this answer

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

Your Answer

 
discard

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