Unix Solaris, version 5.10, ksh. Problem: I have a script with environment variables which I have to execute prior to other scripts. The script belongs to userA and when I log in, and cd to its directory. It doesn't work and the following message appears: Code:
Code:
The command env returns similar results in both cases. Have tested this: Code:
In both cases the PATH variable is the same: Code:
if I use . ./ it works. However, I would like to have it working the other way (<dot><space>), since, this is not the only machine (the other 4 machines are working) with this configuration and the operations personnel have already been trained. Solution: The highlighted blank entry in $PATH is the equivalent of having a dot "." in $PATH (which is a known security issue). When your current working directory is the same as the script it will execute if the script is executable and the user has permission to execute the script. Code:
myscript.sh
PATH=/usr/bin
PATH=/usr/bin:
PATH=:/usr/bin
It is more secure to create a central scripts directory with the scripts owned by root and each script with permissions 755. Then append the scripts directory to $PATH in each user's .profile. Where there is a mixture of user groups on a machine it can be necessary to set the permissions to 750 and use secondary groups to control who can execute a script. A central script can then be executed with the command you describe. We use this technique extensively for ease of maintenance. Also if a user owns a script they can change or delete it !
Have a Unix Problem
Unix Books :-
Return to : - Unix System Administration Hints and Tips (c) www.gotothings.com All material on this site is Copyright.
|