Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I know I could modify /etc/profile.. but is there a better way? I know /etc/profile will affect terminals but I want all processes to be affected. crontab, service manager, startup scripts, etc..

Edit: I have an answer to edit the PATH for cron.. but still want one for startup scripts and executables that are called by service management.

share|improve this question

2 Answers 2

You have to consider the environment in which some of your applications above are running. There are security implications to running theses types of commands with PATHs that they are not expecting. A malicious user who has access to a directory early in the PATH may be able to substitute their own commands and gain access etc.

Startup scripts generally use full paths to the commands they want to run (some may set a restricted PATH) - this ensures that the expected commands are executed.

When invoking a service, the SCM doesn't use PATHS it uses manifests ( /var/svc/manifest/... ). Manifests are xml files and contain all the information required to define how to interact with a given service. Again, full paths to commands are used to ensure the expected commands are executed.

You can set a default PATH (normal users) or SUPATH (for root) in /etc/default/cron. Again you should consider the security implications of doing so - it is much better to use full paths to commands and have the commands define their own PATH if required.

I believe that the default PATH that init passes to SMF and the init scripts is compiled into the init binary and cannot be changed. It is explicitly not read from /etc/default/init.

share|improve this answer
    
All the directories in all the PATHs will only be editable by root. You have mentioned how to change the path for the cron,, but I still want to change the path for the service executables. I know the path to the executable is absolute.. but I want to control the PATHs that the executables themselves use. I am aware that I should be careful when changing which executable will run for a given command. I will probably add all my new PATHs to the end. –  George Bailey Jan 8 '11 at 21:23

I Agree with @lain that you really should just use full paths to the commands you want. that said, most smf methods source /lib/svc/share/smf_include.sh. You could change the PATH variable there, but I would say that is generally a bad idea.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.