« October 2007 | Main | December 2007 »

November 2007 Archives

November 19, 2007

File Attributes in Linux

Got an interesting, new error message tonight when trying to copy out a network config file to a new server:

scp: /etc/resolv.conf: Operation not permitted

The same error would present itself when I tried to edit the file in vi, or echo something to overwrite it. However, it would let me do a "echo # testing >> /etc/resolv.conf" so appending to the end of the file was working somehow. It turns out that ext filesystems, in addition to their read/write/execute permissions, also have "attributes". These can be used to, among other things, make it so a file can have things appended to it, but not be overwritten:

# lsattr /etc/resolv.conf
-----a------- /etc/resolv.conf
# chattr -a /etc/resolv.conf
# lsattr /etc/resolv.conf
------------- /etc/resolv.conf

Why was resolv.conf set like this when I've never seen this before on any Linux system? I hope this was just a fluke and not part of some new update to Red Hat Enterprise Linux 3, but at least I know how to fix it if it crops up again. Hooray for the Ubuntu forums and their having a thread from a user who saw this happen in Ubuntu. And, of course, huzzah for man pages :)

About November 2007

This page contains all entries posted to NuclearDonkey.net in November 2007. They are listed from oldest to newest.

October 2007 is the previous archive.

December 2007 is the next archive.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.34