sourcing .profile for other users


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sourcing .profile for other users
# 1  
Old 06-15-2011
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
# 2  
Old 06-15-2011
What's in the scripts?
# 3  
Old 06-15-2011
Hi methyl, thank you.

Script is simple with only the following lines:

Code:
#!/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.

Last edited by Franklin52; 06-15-2011 at 04:14 PM.. Reason: Please use code tags
# 4  
Old 06-15-2011
This should be sufficient IMHO:
Code:
cd
. ./.profile

# 5  
Old 06-15-2011
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.
# 6  
Old 06-15-2011
What are the names of the new and old directories of the users?
# 7  
Old 06-15-2011
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Do not allow bypassing users .profile

Hello, I find out that there is a way from putty to pass a command to your shell when trying to log in to a server and bypass .profile. Actually you can do this if you open a bash shell. The command to bypass .profile is the following: ssh -t hostname "bash --noprofile" Is there a way to... (32 Replies)
Discussion started by: omonoiatis9
32 Replies

2. HP-UX

Create a new user from using existing users profile

Hello, Just wanting to know if it is possible. Also I am new to command line. I am running 5.1b, if that matters. Thanks in advance (10 Replies)
Discussion started by: bcha
10 Replies

3. UNIX for Dummies Questions & Answers

switch user (su) not sourcing the profile

Usually in solaris/Linux servers , when you do an su - username (space before and after the hyphen) the user's .profile should get sourced. But in the below linux machine it is not. As you see below ORACLE_HOME variable is not being set. # uname -a Linux revaltb214 2.6.18-238.el5 #1 SMP Sun... (7 Replies)
Discussion started by: John K
7 Replies

4. Solaris

Remove a given profile from a users account

Hi Guys, I was studying RBAC and I gave a profile to a user . I have not seen anywhere that shows how to remove the profile from the users account. Can anyone show me how to remove a given profile from a users account? Thanks alot guys. (2 Replies)
Discussion started by: cjashu
2 Replies

5. Shell Programming and Scripting

Users who desire to have their .profile executed must explicitly do so in the crontab entry. Why?

The .profile file should be read when the user logs in. So, there should be no need to execute .profile file again in a cron job (since the cron job is run after the user logs in). Doesn't the cron require login from the user. Then, from where does the cron execute? Please help!! (1 Reply)
Discussion started by: thulasidharan2k
1 Replies

6. AIX

SSH and a users .profile

How do I get a command like "ssh Theuser@host date" to execute the /home/Theuser/.profile before executing the "date" command? (5 Replies)
Discussion started by: IL-Malti
5 Replies

7. UNIX for Advanced & Expert Users

How can I get sudo -u <username> to load that users profile on HP-UX

I am running a serverapplication on a HP-UX machine where I need to handle some of the commands as a specified user called "druser". When I log on as this user with the command; sudo -u druser -sit starts an instance of the shell as that user. However, it doesn't load that users .profile from... (1 Reply)
Discussion started by: ukiome
1 Replies

8. Solaris

rootsh on Solaris 10 is not sourcing root's .profile

I'm attempting to setup rootsh on Solaris 10 to log the activity of users who require root access. However it does not appear to be sourcing root's .profile file even when run with the '-i' option. I was wondering if anybody else has run into this and might have a solution. Thank you. (9 Replies)
Discussion started by: kungfusnwbrdr
9 Replies

9. Shell Programming and Scripting

users with same .profile

guys i have a unix user (say "x") which is also an application owner ..thru this user i manage most (90 %) of my tasks related to application i.e application down/up,processes stop/start etc..in short i manage my "tuxedo" via this user.. now i want a new user to be created (on my name) which... (7 Replies)
Discussion started by: abhijeetkul
7 Replies

10. UNIX for Dummies Questions & Answers

changed .profile but didnt ./.profile, yet reflected changes

hi , i added ls -F to .profile. and i need to do ./.profile for the effect to take effect BUT i didnt and YET the next day when i came to work and log in, the changes took effect. i am on aix. please explain.. thanks (4 Replies)
Discussion started by: yls177
4 Replies
Login or Register to Ask a Question