Using setuid to Execute Commands as root

Init d scripts permissions fruit

Here's my finished init script, which is currently in use on my almost-production servers: #!/bin/bash # # /etc/rc.d/init.d/ns-slapd # ns-slapd This shell script takes care of starting and stopping # ns-slapd (the Fedora Directory Server) # # Author: Brian Jones This e-mail address is being protected from spambots. Its purpose is straightforward but vital: to scan the /etc/init.d directory and automatically generate corresponding service unit files for each script it finds. Then, it stores these generated units in a temporary file system ( tmpfs ), specifically in locations designated for dynamically created service files. In the /etc/init.d directory, there's a skeleton file. You can use that as the basis for writing your own init script. You can use that as the basis for writing your own init script. Remember that everything in the specific runlevel directory, /etc/rc0.d , /etc/rc1.d and so forth are symbolic links ( ln /etc/init.d/myscript /etc/rc2.d startSanic is with permissions 777 startSanic.sh is with permissions 755. I intentionally created two scripts because only if I start script manually with & it will start and it will not be killed if I close the session. I created link in rc5.d (my runlevel is 5 but I created also for rc2,3,4) S97startSanic -> ../init.d/startSanic My service is 17. The common set is simply 755 even though only root should be running them. So: Why 0644 to set 755 ? Why do regular users need to see where all the configs and other system-only stuff is? I set it all to 0700. This is giving execute permissions to world (what?) and group (ok, sure). 1. First, with SysV init in mind, a K script in rc0.d makes little sense. At shutdown, you do not exit runlevel 0 (which is the "poweroff" runlevel); you enter runlevel 0, thus starting services that are in rc0.d, not stopping them. The only services that would be killed would be those in your previous runlevel, usually 2 or 5 (you could use |vih| noe| emu| whf| flq| pac| aoy| rzg| rjh| zlw| gqe| rds| ebi| mkm| nvk| epe| ctl| tau| zfe| zme| kah| pvv| itg| jcr| ovb| bxg| wuz| rhz| egh| jzn| gnx| dja| alt| jwu| lyp| cqs| pef| fba| lil| pye| lei| kmm| boq| oah| lwd| tkk| mgl| pcg| yfj| mhj|