In Unix, Can I own a file that I cannot read?
If so, How can I do it?
|
|
|
That's impossible. If you are the owner of a file, you should be able to read it. You can try: |
|||||||
|
|
The answer is yes, you can unset the read-flag for your file. But as a owner you (and a program running with your rights) can set the flag again. but for a program that does not do it automatically, you can forbid read-access this way. |
|||
|
|
|
This is probably impossible to do it portably (POSIX). However, if you are running Solaris 10 or newer, here is a way to prevent a user to persistently set the permissions on a given file using a dtrace script.
You need to run it as root (or a user having sufficient privileges to run dtrace) and pass three parameters to the script: the target userid, the (base)name of the file to protect and its full path. e.g.
On a second window, here is a sample session showing the dtrace script result:
Of course this is kind of a hack, isn't at all representative of what dtrace is designed to allow and has certainly race conditions and other deficiencies to be completely reliable but is anyway a method to achieve what you want. |
|||
|
|