I want all files in directory /home/alex/foo
to be owned by alex
, no matter who creates them. I'm trying this technique, but it doesn't work (on CentOS 5, under root
):
$ cd /home/alex
$ mkdir foo
$ chmod u+s foo
$ chown alex foo
$ ls -al . | grep "foo"
drwsr-xr-x 2 alex root 4096 Nov 14 14:18 foo
$ echo "test" > foo/test.txt
$ ls -al foo
total 12
drwsr-xr-x 2 alex root 4096 Nov 14 14:19 .
drwxr-x--- 13 alex root 4096 Nov 14 14:18 ..
-rw-r--r-- 1 root root 6 Nov 14 14:19 test.txt
As you see, the file is owned by root
, but should be owned by alex
. What am I doing wrong?