locking a file in linux

Status
Not open for further replies.

simple

In Runtime
Messages
171
Location
Earth
hey guys i was wondering if i could lock a particular file in linux [by any means available or necessary ;) ] . i had mentioned in an earlier post of mine that i wanted to stop the root owner from accessing my files but nobody had a solution so thats why i am asking this question.
i think you can lock a particular folder in windoze and if you can do it in windoze then linux should do it better...
hope i get some good replies.....
c ya!!
 
as far as i know there is no way to really lock out root access to a file. the whole purpose of root is that it is practically omnipotent in terms of power over the system. if you want to hide the file then you really need to be the root account, then it can be hidden and locked easily from all other users. using sudo things are simplified and you can integrate access to the file easily into your own account.

i guess as an alternative there is encryption, whereby you are the only one possessing the key. i'm not sure exactly how to employ this but it's an angle to work on :)
 
encryption is just a way to make the file non-human readable. (the root can still delete it!). i thought there would be some utilities or some tricks by which i could lock my data. is there no way that i can block access to a particular file?
c ya!!
 
There is no way to block root access. That defeats the purpose of having the root account. If the root users cant delete it then what is the point of having a root user that has full control?
 
Why would you want to block root access to a file. If you can't trust him/her with the file, then why should he/she have root access to your machine in the first place? The best practice is to choose your administrators wisely. Don't let those you don't trust have admin access to your PC. Or, if it's someone else's PC, do whatever you need to do on your own PC.
 
CalcProgrammer1 said:
Why would you want to block root access to a file. If you can't trust him/her with the file, then why should he/she have root access to your machine in the first place? The best practice is to choose your administrators wisely. Don't let those you don't trust have admin access to your PC. Or, if it's someone else's PC, do whatever you need to do on your own PC.
thanks for the advice but don't you think i would have thought of that.
but apparently from all the posts i have seen i guess one fact is clear that we really cannot restrict access to a particular file by the root user.
however can i hide the file so safely that even if the root does an ls -a in the parent directory still my files won't show??
is this possible?
thanks for your time... c ya!
 
You can hide a file, but it's possible to see it by turning on hidden folders (it probably won't hide in command line utilities like ls). The simple fact is, root users are the master admins of a Linux system. They have access to all files, folders, and devices on the PC.
 
I think that the best solution is to compress the file with rar and apply a password on the file, or use a program to encrypt the file.
 
Encrypting the file will keep it private, backing up the file to a USB key or something that you keep away from other users/online spam or viruses (unlikely) will keep it from being deleted. That's the only thing I can think of to keep a file from other root users.
 
Status
Not open for further replies.
Back
Top Bottom