Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 05-05-2008, 10:52 AM   #1
Registered: Oct 2005
Location: Bangladesh
Posts: 490

Rep: Reputation: 30
Only owner of a text file can "cat" a text file !

Friends ,

Suppose as Oracle user I have create a file test and give some entry like :
vi test
"My name is john"

Now I want a situation where only oracle user can "cat" this "test" file . Another user (also root) cannot "cat" this "test" file ?

Is it possible to do ?

Is it possible to hide a line in a text file ?So that another user (except owner) cannot see the entry of the text file .

Plz help .. ...
Old 05-05-2008, 11:01 AM   #2
LQ Guru
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 19,176

Rep: Reputation: 4401Reputation: 4401Reputation: 4401Reputation: 4401Reputation: 4401Reputation: 4401Reputation: 4401Reputation: 4401Reputation: 4401Reputation: 4401Reputation: 4401
Please see the man pages for chown and chmod.

The command chmod 700 will allow the owner of the file to read, write, and execute it, while no other users or groups (aside from root), can. The man pages will give you more detail
Old 05-05-2008, 11:01 AM   #3
Senior Member
Registered: Feb 2003
Location: N'rn WI -- USA
Distribution: Kubuntu 8.04, ClarkConnect 4
Posts: 1,142

Rep: Reputation: 47
Root can do anything. If some other user has root access, then they can do whatever you can.

As for standard users, chown the file ( to whatever user it want...
chown this_file

Then, chmod the file to owner only permission...
chmod 0600 this_file

That way, only the user oracle (or root) can read/write that file.

I'm pretty sure the second scenario isn't possible... If somebody has read permission for a file, then they can read the whole file.
Old 05-05-2008, 11:23 AM   #4
Registered: May 2001
Posts: 29,359
Blog Entries: 55

Rep: Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546Reputation: 3546
* ...and if this is for obfuscating passwords or malarky like that you can just forget about it.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
get everything following the "DESCRIPTION" tag in a text file powah Programming 3 02-19-2008 10:48 AM
removing first "0" or "63" in a text file tmaxx Linux - General 5 07-10-2006 08:08 AM
trying to redirect text to a file to cat at later point. says file doesn't exist. dr_zayus69 Programming 1 10-02-2005 08:10 AM
"how do I extract a number from a text file using shell command?" sdandeker Linux - Networking 3 02-12-2004 08:54 AM
How can I catch some "KEY WORDS" from a text file without opening it? yuzuohong Linux - General 1 06-14-2002 09:27 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:01 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration