sourcing .profile for other users

Hi Team,

Thank you for your time.

i have a situation where the user IDs of the applicatio users have been locked down to Read only.
Hence I am writing a script to invoke their old .profile every time they login.

My problem is : when i run . $userpath/.profile from within the ksh script I get "Managers not found" error.
profileload.ksh[10]: Managers: not found
But when i execute the same line in coomand prompt I get the required result.

Any help would be appretiated.

Thanking you.

Anitha

What's in the scripts?

Hi methyl, thank you.

Script is simple with only the following lines:

#!/usr/bin/ksh
##Script to execute user's .profile at login
username=`who am i | awk '{print $1}'`
cd ~$username
#userpath=`pwd`
#. $userpath/.profile
. ./.profile
echo "run successful"

I do not get the desired result when I execute the .profile from within the script.

This should be sufficient IMHO:

cd
. ./.profile

Hi Franklin,

As you suggested . ./.profile should is enough.

but here the users now have a new .profile and I am trying to source their older .profile by reaching to their older home directory.

username=`who am i | awk '{print $1}'`
cd ~$username
. ./.profile

When I execute this script now, it shows no error but i cannot access my older aliases and ENV.

Instead if i type cd <user's old home directory> and . ./.profile in command prompt I am able to get the old profile back to action.

The challenge is I need a script so that send it to every user to run and I cannot ask them to execute it every time they login.

Any ideas?

Thank you in advance.

What are the names of the new and old directories of the users?

The older one was /home/coverage/username

And they hav been shifted to /home/readonly

I think now its more clear. They want to use profile of older folder.

Should be something like:

username=$(whoami)
cd /home/coverage/$username
. ./.profile

Hi,

I tried exactly this but somehow it doesnt overrides the new profile.

Is there any other way of invoking their older profiles as soon as they login?

You should put the code above in the .profile of the users.