Нужно чтобы программа с битом suid запустила скрипт с правами root, но sh не хочет с правами root запускаться, он всё равно запускается с правами пользователя.
Ссылки пока не смотрел, но вообще вот:
#!/bin/sh
mkdir /home/dim/lalala
mkdir /lalala
___________________________
#include <unistd.h>
int main(int argc,char *argv[]){
execl("/bin/sh","/bin/sh","/home/dim/Desktop/test/sh",0);
}
________________________-
первая команда выполнилась, а вторая нет
Я в программировании на сях под линух не силен, но могу посоветовать использовать аналог su, т.е. явно задать, что дочерний процесс ты запускаешь от рута.
man bash (т.к. в линуксе /bin/sh это линк на /bin/bash)
If the shell is started with the effective user (group) id not equal to
the real user (group) id, and the -p option is not supplied, no startup
files are read, shell functions are not inherited from the environment,
the SHELLOPTS variable, if it appears in the environment, is ignored,
and the effective user id is set to the real user id. If the -p option
is supplied at invocation, the startup behavior is the same, but the
effective user id is not reset.
>скрипт с suid
Я имел в виду "программа с suid-правами". И это было просто предположение. >а потом нубы ноют про "мифы о безопасности линупса".
Это к чему?