[CentOS] File permissions

Woodchuck marmot at pennswoods.net
Sat Mar 10 15:09:40 EST 2012


On Sat, Mar 10, 2012 at 01:45:19PM -0500, Robert Spangler wrote:
> Hello,
> 
> I need to know if there is something I am missing about file permission as I 
> believe I am seeing some strange stuff on my system.  I have a directory as 
> follows:
> 
> drwxrwxrwx   7 root root  4096 Mar 10 13:35 temp
> 
> In this directory I have a file:
> 
> -rw-r--r--  1 root root       137 Oct 30 02:16 208-109-248-33test
> 
> As a normal user should I be able to rename this file?  I believe that only 
> root should be able to modify this file but as a normal user I am able to 
> rename it without elevated privileges as so:
> 
> temp $ mv 208-109-248-33test 208-109-248-33-mv
> 
> [Sat Mar 10 13:41:05] /temp
> 
> temp $ lt 208*
> -rw-r--r-- 1 root root 137 Oct 30 02:16 208-109-248-33-mv
> 
> How is this possible?  If it is possible what am I missing or not 
> understanding?  Thnx.

As Mr Owen remarks, nothing is broken.  To get the mode ("permissions")
semantics that you might be expecting, set the "sticky bit" of the
directory.

<root> # chmod +t temp

Then the mode will appear as  "drwxrwxrwt"  ( 1777 in octal).

Notice that this is the same as the mode for /tmp.

"In Unix, everything is a file."  Directories are files, too.

Dave


More information about the CentOS mailing list