LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 08-22-2012, 05:27 PM   #1
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 421
Blog Entries: 28

Rep: Reputation: 2
Make a file not overwriteable


Hi, I don't know why, whenever I "touched" my admin network options, it tries to overwrite my /etc/resolve.conf file, and this causes me not able to connect to the www properly. I have to take some time to figure out this problem when it occurs and I have to login as root to edit the file. I wish to make the file not overwriteable. I already chmod the file to 444 only, but it seems still to be able to be overwrited, the system seems to have the power of root. I wonder if I could "fix" the file somehow so that the system can't modify it.
Thanks,
Ted
 
Old 08-22-2012, 05:33 PM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Location: Youngstown, Ohio
Distribution: LM17.1/Xfce4.11.8
Posts: 7,163
Blog Entries: 10

Rep: Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979Reputation: 1979
sudo chmod 0000 /path/to/file ?
 
1 members found this post helpful.
Old 08-22-2012, 05:37 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,130
Blog Entries: 2

Rep: Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825Reputation: 4825
Code:
chattr +i /etc/resolv.conf
will set the immutable flag for the file in question. For more info on chattr have a look at
Code:
man chattr
 
1 members found this post helpful.
Old 08-22-2012, 05:39 PM   #4
sag47
Senior Member
 
Registered: Sep 2009
Location: Orange County, CA
Distribution: Kubuntu x64, Raspbian, CentOS
Posts: 1,831
Blog Entries: 36

Rep: Reputation: 451Reputation: 451Reputation: 451Reputation: 451Reputation: 451
Set the file to be immutable.

Code:
chattr +i /etc/resolv.conf
To disable it just
Code:
chattr -i /etc/resolv.conf
edit: ah tobi beat me to it
 
1 members found this post helpful.
Old 08-22-2012, 05:52 PM   #5
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 421
Blog Entries: 28

Original Poster
Rep: Reputation: 2
Thanks!
 
Old 08-22-2012, 09:02 PM   #6
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Rep: Reputation: 90
I use
Code:
chattr +i cover_image.jpg
on front cover images of albums. Since I keep the front cover images in the same directory as the mp3 files making the image immutable helps me avoid mistakes like
Code:
id3v2 -a Foreigner *
in which case the poor image would have undesirable id3 tag information were it not immutable. That's just one example. And my 2 cents worth.

Last edited by SharpyWarpy; 08-22-2012 at 10:21 PM. Reason: Proper [CODE] usage
 
1 members found this post helpful.
  


Reply


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
make with make file yields error: /usr/bin/javac: cannot execute binary file bweaver Ubuntu 4 11-19-2010 03:58 PM
Help needed for make file problem : make: *** No rule to make target `flash', needed rameshsatyavaram Linux - Newbie 3 09-11-2008 03:13 AM
Make Trouble linking some fortran code Make file problem? any ideas? TheBrick Linux - General 0 05-17-2006 12:21 PM
make a .img file for custom liveCD, dd?? (Also, how to make your system very small) 1veedo Linux - Newbie 6 05-07-2006 06:52 PM
I accidentally deleted make file in /usr/local/bin, now cannot use make command.... Niceman2005 Linux - Software 2 11-17-2004 08:55 PM


All times are GMT -5. The time now is 10:42 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration