LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


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

Rep: Reputation: 31
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 ?

OR,
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
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,699

Rep: Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972Reputation: 7972
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
ranger_nemo
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 (owner.group) to whatever user it want...
chown oracle.oracle 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
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

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


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:37 AM.

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