当用户通过SUID位提升到根目录时,smbd不会启动或停止
在Ubuntu 12.04下,我编写了下面的C程序,帮助我closures服务器的apache2和samba服务,同时运行自动备份。 请注意,在Makefile中,我设置了SUID位,以便程序在由低级用户tmv运行时具有root权限。 services.c: #include <stdio.h> #include <stdlib.h> void usage(char * arg0) { printf("Usage: %s start|stop\n", arg0); exit(1); } int main(int argc, char ** argv) { fprintf(stderr, "Running as: "); system("whoami"); if (argc != 2) usage(argv[0]); if (!strcmp(argv[1], "stop")) { printf("Before running rsync, we need to shut down apache2 and smbd.\n"); system("service apache2 stop"); system("service […]