Summary: su - <user> doesn't read <user_home>/.profile

From: Husemann, Harald <harald.husemann_at_Materna.DE>
Date: Thu Mar 13 2003 - 06:54:35 EST
Hi,

and thanks to all who replied:

Martynas Buozis
Casper Dik
Samier Kesou

(Original posting below)

It seems that Solaris really doesn't read private profiles at all, when you
invoke "su - -c". So, I just put my .profile in /etc/profile, and sourced
that using su - -c ". /etc/profile; <command>". That works...
Maybe su doesn't like dot-files, :-)

(Martynas: It's right, .profile is only read in login-sessions - but,
creating a .bashrc also doesn't work. It seems to be something special with
the su-command, when you use it to execute commands in user's environment)

Thanks to all,

have a nice hackin',

Harald

============================================
Harald Husemann
Systems Engineer
Teammanager Unix administration and Configuration Management
Materna Gmbh - Vo_kuhle 37 -
D-44141 Dortmund, Germany
Phone:  +49-231-5599-8684
Mobile: +49-179-2300651

-----Urspr|ngliche Nachricht-----
Von: Husemann, Harald [mailto:harald.husemann@Materna.DE]
Gesendet: Donnerstag, 13. Mdrz 2003 10:25
An: sunmanagers@sunmanagers.org
Betreff: su - <user> doesn't read <user_home>/.profile


Managers,

I have a little problem:

I'm using the following command inside a script to execute a command with
another user's right:

su - <user> -c "<command>".

The manpage says that with "su -" su should read the user's .profile, but it
seems it doesn't - I even tried the following:

su - <user> -c ". ~/.profile; <command>".

But, that also didn't work, the profile is read (saw that with a truss), but
e. g. the $PATH-variable isn't changed.
(Just used echo $PATH and examined the output).

Any ideas what's wrong here??

User's Shell is set to /bin/bash, and I also tried it with ~/.bash_profile,
without success.

Thanks for your help,

keep on hackin',

Harald

============================================
Harald Husemann
Systems Engineer
Teammanager Unix administration and Configuration Management
Materna Gmbh - Vo_kuhle 37 -
D-44141 Dortmund, Germany
Phone:  +49-231-5599-8684
Mobile: +49-179-2300651
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Thu Mar 13 06:58:33 2003

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:43:05 EST