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 have a configuration file with me and want to make the file unreadable to others.. What can be done with it?? Encryption is a way to do it.. But Encryption makes the file uninstallable in Linux platform.

share|improve this question

closed as not a real question by John Gardeniers, mdpc, Ward, Khaled, Bryan Feb 17 '13 at 14:12

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
Maybe I am missing what is being asked here. By the comments it sounds like you are trying to create a configuration file that is shared to others on other systems but is not able to be read by them and at the same time readable by something that doesn't know anything about an encryption algorithm. If that is the case, this is not possible...At all. You can control permissions of a file on a particular system as others have noted below, but it isn't possible to have a file that is readable by some and not by others across systems unless you are doing something like public key cryptography. –  Alex Feb 16 '13 at 22:02

3 Answers 3

Change the permissions on the file so that only the owner can read it and that group and all-users (others) can't read/write/execute it.

chmod go-rwx file

http://www.linux.com/learn/tutorials/309527-understanding-linux-file-permissions

share|improve this answer
    
I want to make it permanent.. So that it can't be changed.. –  Hridoy Dutta Feb 16 '13 at 21:30
    
The file would a .conf file. So it needs to be unreadable and should be able to install also. –  Hridoy Dutta Feb 16 '13 at 21:32
    
You mean that nobody else can change the permissions? Only the owner and root would be able to do that with this permission setting. –  ETL Feb 16 '13 at 21:33
    
I'm not following the unreadable part. The file has to be readable to the process that needs it's configuration information. –  James Thompson Feb 16 '13 at 21:34
    
Ya. I mean once it is made unreadable, no one can change it but it should be able to use the code inside it which will be used in the file installation. –  Hridoy Dutta Feb 16 '13 at 21:35

You can use chmod to see the permissions on the file

chmod 600 filename

This will make the file readable and writable by only the owner of the file.

share|improve this answer
    
Can it be done permanantly on a file? –  Hridoy Dutta Feb 16 '13 at 21:44
    
Yes, file permissions are permanent. –  grassroot Feb 16 '13 at 22:16

You can make the file unreadable by regular users, by changing the file mode (chmod) or the file attributes (chattr) or file system access control (setfacl). But remember, there is NO WAY you can prevent the root user from reading the file. The root user will be able to reset what ever restriction you put on the file.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.