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


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How can I get sudo -u <username> to load that users profile on HP-UX
# 1  
Old 12-14-2009
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;
Code:
sudo -u druser -s

it starts an instance of the shell as that user.
However, it doesn't load that users .profile from his home directory so I don't get the path or prompt for this user.
Each time I have to input this manually after the sudo -u command.

Is there a way to automatically get the users .profile processed when loggin in as a user this way?

PS. Btw the machine is a HP-UX B.11.11 U 9000/800 if that matters. DS.
# 2  
Old 12-14-2009
In this case you should get your sysadm to add in sudoers a line like this:
Code:
user ALL = NOPASSWD : /usr/bin/su - newuser -c <the command(s)...>

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. Solaris

How to give sudo entry in .profile file in Solaris?

Hi all, In Solaris , What entry should I add in my .profile file in home directory so that every time I don't have to give Sudo's full path like /usr/local/bin/sudo as well as /usr/sbin/ping and it will be Great help if you could tell me how to know what should be added. Please Advice.... (2 Replies)
Discussion started by: manalisharmabe
2 Replies

3. UNIX for Advanced & Expert Users

ssh & load custom profile

i've created a custom profile that contains custom functions and alias' etc... it's called .jason_profile currently we ssh to the server then load the profile manually from the cmd line i.e . /home/jack/.jack_profile we want to be able to ssh and source the profile automatically but... (4 Replies)
Discussion started by: jack.bauer
4 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

How to see actual username who logged in as root with sudo

Hi, Thanks for looking at this. I would like to know who is actually logged in as sudo root ? ex: i have many users given sudo rights as root, and all of they are making changes as root and it is difficult for me to know who did what ,a s it shows as rot only. Is there any way to find or... (4 Replies)
Discussion started by: ramanaraoeee
4 Replies

6. Shell Programming and Scripting

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... (9 Replies)
Discussion started by: anitha111
9 Replies

7. 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

8. UNIX for Dummies Questions & Answers

Permit sftp load /etc/profile on AIX6.1

Hi, I've set on /etc/profile: TMOUT=3600 readonly TMOUT It seems to work when I connect using ssh client, putty for example, but not when connect through sftp. What am I missing on sshd configuration? regards Israel. (2 Replies)
Discussion started by: iga3725
2 Replies

9. UNIX for Dummies Questions & Answers

create and load my own .profile

Hello to everyone, This is my first that I use any group in order to find a reply to my question. I would really like your help!!! Do you know how can I create my own .profile file in unix (not edit the existing one) and how can I load it when i open a new bash? I would like those settings... (1 Reply)
Discussion started by: unbalanced
1 Replies

10. 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
Login or Register to Ask a Question