[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: suid



Hello,

> Everybody knows that files with a suid bit set can be dangerous.

yes :) sgids too :)

> Well, i was asking myself today why exactly linux uses the suid bit files?!

because binaries are executed with almost the same rights as the
user-owner-of-file [effective UID]

> Could someone please explain that to me?
> Example:
> ~$ ls -lah /var/spool/cron/crontabs/user
> -rw-------    1 root     user           408 Apr 16 

where are you have any suid ? I dont see any.

> Ok, the suid is set for the crontab binary because you have to edit the root
> owned file.

# ls -l `which crontab `
-rwsr-xr-x    1 root     root        22460 Oct  1  2001 /usr/bin/crontab

yes, because only in this condition normal user can set crontab rules.

man:
/usr/bin/crontab
crontab needs to be suid root to edit crontab files in /usr/spool/cron/crontabs and to signal() cron.

If you disable suid for crontab binary this will be like that:
$ crontab -l
seteuid: Operation not permitted

I am thinking about changing directory from /var/spool.... to another
but ... signals..... I don't know. Maybe sombody know ?

Everybody are agree with me ?

> But why is it owned by root in the first place?

I dont know, maybe root-owned [setuided] binary crontab set it ?
And why ? because - when - user will be able to write to this file - he
will be able to write to partition where /var/spool/cron/crontabs/ is
mounted.

-- 
Pozdrawiam,
Marcin.



Reply to: