LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-14-2007, 04:20 PM   #1
srarcade
LQ Newbie
 
Registered: Oct 2007
Posts: 6

Rep: Reputation: 0
Root cannot chmod a file


I am stumped!

So I was having some issues with my dhcp ip resetting so a guy at work told me to chmod my resolv.conf a certain way and it was able to stick since nothing could modify it. Now that I want to remove that ip, i can't because the file is unable to be chmod'd, chown'd, modified, deleted or anything, even by root!

ls -l /etc/resolv.conf
-rw-r--r-- 2 root root 61 2007-08-22 09:57 /etc/resolv.conf

Whats up with the '2' before root? I am suspicous of this because it I think it should be a 1. Just a hunch.

Any help here is greatly appreciated!
 
Old 10-14-2007, 05:15 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by srarcade View Post
Whats up with the '2' before root? I am suspicous of this because it I think it should be a 1. Just a hunch.
That number is the number of hard links sharing the same inode. To find which and where is the hard link, you can do
Code:
ls -i /etc/resolv.conf
to find the inode number and then do a find with the -inum test. Or do simply
Code:
find / -samefile /etc/resolv.conf
you can restrict the search first by looking inside /etc itself.
 
Old 10-14-2007, 05:23 PM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Look at "lsattr /etc/resolv.conf". I bet that you set the 'i' attribute. You can use the "chattr" program to clear it.

What was the command you used before?
 
Old 10-14-2007, 05:36 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Or maybe there's a rather anal set-up for SELINUX?



Cheers,
Tink
 
Old 10-15-2007, 02:02 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
An update to my previous post. I checked on a Fedora Core 5 system and my /etc/resolv.conf has 2 hard links, too. Running the suggested command in /etc I find:
Code:
# find /etc -samefile /etc/resolv.conf -exec ls -il {} \;
64965 -rw-r--r-- 2 root root 92 Sep 12  2006 /etc/resolv.conf
64965 -rw-r--r-- 2 root root 92 Sep 12  2006 /etc/sysconfig/networking/profiles/default/resolv.conf
that is nothing to be worried about. Regarding your original question, I agree with both the suggestions from jschiwal and tinkster. Most likely you already have the solution to this issue!
 
Old 10-15-2007, 08:24 AM   #6
srarcade
LQ Newbie
 
Registered: Oct 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Thanks guys for the quick response, very informative! I will have to try this when I get home later but I wanted to post my appreciation for your help.
 
Old 10-15-2007, 08:09 PM   #7
srarcade
LQ Newbie
 
Registered: Oct 2007
Posts: 6

Original Poster
Rep: Reputation: 0
Just an update- was able to identify the problem with 'lsattr /etc/resolv.conf' to see the i flag was in fact set. Used 'chattr -i /etc/resolv.conf' to clear it and the file was editable once again.

Thanks so much for the help guys!
 
  


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
Root user unable to rm, mv or chmod Zoar Linux - Newbie 3 10-10-2019 03:12 PM
chmod a file requires root? G00fy *BSD 4 05-04-2007 10:03 PM
NFS Root setup - can't log in as root after CHMOD ? gallwapa Linux - General 1 04-02-2007 04:31 AM
CHMOD files for all users as root, how?! $Linuxnoob Fedora 3 04-09-2006 10:31 PM
can't chmod under root Kanaflloric Linux - Newbie 10 08-13-2004 11:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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