ha
分类: LINUX
2011-01-21 22:45:31
Init is a parent process for all the other processes of the system. Other processes inherit environment of the init process and the path is the init path in the rare case that no other path is set.
The 'init path' is fixed in the source of the init program and it is:
/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin
Note that init path does not contain /usr/local/bin. (看看,就这里写着呢。。。。)
All the programs that are started from /etc/inittab work in init environment, especially system initialization scripts in /etc/init.d (Debian 1.3).
Everything that is started from system initialization scripts has init environment as default environment. For example, syslogd, kerneld, pppd (when started from startup), gpm and most importantly lpd and inetd have init environment and they do not change it.
A group of programs are started from startup scripts but the PATH environment variable is explicitly set in the startup script. Examples are: atd, sendmail, apache and squid.
There are other programs that are started from boot scripts but they change the path completely. One such example is cron.
这篇文档里还有很多path方面的解释,包括我见过很多身边朋友在su时,最不在意的“-”,后果有时很严重,呵呵