LinuxQuestions.org
Help answer threads with 0 replies.
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 08-22-2012, 04:27 PM   #1
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
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, 04:33 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

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

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
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, 04:39 PM   #4
sag47
Senior Member
 
Registered: Sep 2009
Location: Raleigh, NC
Distribution: Ubuntu, PopOS, Raspbian
Posts: 1,899
Blog Entries: 36

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
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, 04:52 PM   #5
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431

Original Poster
Blog Entries: 32

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

Rep: Reputation: 91
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 09:21 PM. Reason: Proper [CODE] usage
 
1 members found this post helpful.
  


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

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

All times are GMT -5. The time now is 10:52 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