× Welcome to the Centrify Community! We are rolling out product name changes — click here to learn more.

Environment PATH different when su vs logging in directly

Showing results for 
Search instead for 
Do you mean 
Reply
Participant II
Posts: 3
Registered: ‎05-25-2017
#1 of 5 291
Accepted Solution

Environment PATH different when su vs logging in directly

Hello,

I recently installed Centrify 2017.1 on a server where we have a local user that Tomcat runs as.  When I log in as an AD user and SU to the user the bash script we have in the environment variables is not working.  But if I log in directly as that local user it works fine.  Here are the differences in the commands echo $PATH.  

 

Correct one -

[rmwm@rmwmqa02 ~]$ echo $PATH
/usr/lib64/qt-3.3/bin:/opt/jdk1.8.0_60/bin:/usr/share/centrifydc/bin:/usr/localbin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/rmwm/bin

 

Incorrect 

 

[rmwm@rmwmqa02 ~]$ echo $PATH
/opt/jdk1.8.0_60/bin:/opt/jdk1.8.0_60/bin:/usr/lib64/qt-3.3/bin:/opt/jdk1.8.0_60/bin:/usr/share/centrifydc/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/sbrennan_admin/bin

 

 

The part that makes the script work from any directory is the sbin:/home/rmwm/bin.  Why would that be missing from same user account when I SU.  

 

Thanks

Centrify Guru I
Posts: 1,820
Registered: ‎07-26-2012
#2 of 5 285

Re: Environment PATH different when su vs logging in directly

@sbred73,

 

Welcome to the Centrify forums.

This may be a weird question, but what is the syntax you're using with switch user (su)?

 

are you doing this:

su rmwm

or are you doing this

su - rmwm

?

 

Also, are you using sudo  (or dzdo) prior to su?

 

R.P

 

Moderation notice:  We always appreciate getting the Operating System and version (uname-a) and CentrifyDC version (adinfo -v), it eliminates a few back and forths.

Want to learn more about practical Centrify examples? Check out my blog at http://centrifying.blogspot.com
Follow Centrify:
Participant II
Posts: 3
Registered: ‎05-25-2017
#3 of 5 284

Re: Environment PATH different when su vs logging in directly

Just simply SU rmwm, no sudo or dzdo.


BTW the OS CentOS release 6.3 - 2.6.32-279.5.2.el6.x86_64 #1 SMP Fri Aug 24 01:07:11 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
Centrify Guru I
Posts: 1,820
Registered: ‎07-26-2012
#4 of 5 281

Re: Environment PATH different when su vs logging in directly

Do me a favor, try

su - rmwm

 

That is su, then a space, then a hyphen, then a space, then the name of the user and report back your results.

 

Reference:

https://wiki.archlinux.org/index.php/Su

The hyphen has two effects:

1) switches from the current directory to the home directory of the new user (e.g., to /root in the case of the root user) by logging in as that user

2) changes the environment variables to those of the new user as dictated by their ~/.bashrc. That is, if the first argument to su is a hyphen, the current directory and environment will be changed to what would be expected if the new user had actually logged on to a new session (rather than just taking over an existing session).

Want to learn more about practical Centrify examples? Check out my blog at http://centrifying.blogspot.com
Follow Centrify:
Participant II
Posts: 3
Registered: ‎05-25-2017
#5 of 5 277

Re: Environment PATH different when su vs logging in directly

That did the trick! Thanks for the help!