SUID flag of a file magically disappeared
Posted in Uncategorized on June 22nd, 2011 by Johan Huysmans – Be the first to commentIf you set a SUID flag on a file, this flag will disappear when the ownership (user or group) is changed of that file!
Let me show you:
[root@raskas ~]# touch test
[root@raskas ~]# ll test
-rw-r--r-- 1 root root 0 2011-06-22 17:10 test
[root@raskas ~]# chmod u+s test
[root@raskas ~]# ll test
-rwSr--r-- 1 root root 0 2011-06-22 17:10 test
[root@raskas ~]# chown johan:johan test
[root@raskas ~]# ll test
-rw-r--r-- 1 johan johan 0 2011-06-22 17:10 test
[root@raskas ~]# chmod u+s test
[root@raskas ~]# ll test
-rwSr--r-- 1 johan johan 0 2011-06-22 17:10 test
[root@raskas ~]# chown root:root test
[root@raskas ~]# ll test
-rw-r--r-- 1 root root 0 2011-06-22 17:10 test
[root@raskas ~]#