LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   SSH without root environment variables exported on CentOS 5.8 + SELinux (https://www.linuxquestions.org/questions/linux-server-73/ssh-without-root-environment-variables-exported-on-centos-5-8-selinux-4175419393/)

ecataranciuc 07-30-2012 12:18 PM

SSH without root environment variables exported on CentOS 5.8 + SELinux
 
Hello!
I have a server on CentOS 5.8 + SELinux. The problem is that environment variables are not set up at login time through SSH. For example:
1. I login through SSH as a regular user.
2. su as root.
3. Trying to use any command from /sbin without the full path.
4. I get a "bash: *: command not found" error.
If I do "source /etc/profile" I can use the commands from /sbin without specifying the full path.
It is not because of SELinux. I disabled it and got the same result. On CentOS 6.3 I didn't have this problem. The OpenSSH version was a newer one though. Don't remember which.
How can I solve this?

uname -r: 2.6.18-308.el5xen
OpenSSH_4.3p2

mesiol 07-30-2012 12:50 PM

Did you try
Code:

su -
?

ecataranciuc 07-30-2012 01:03 PM

OK. Got it working. But why on a newer version of CentOS and SSH everything was working without "su -", just "su"?!

MCD555 07-31-2012 06:30 AM

The su - command set up all envionment variables and paths of root.
Probably in 5.8 normal users, for security reason, have a better profiles!

Reuti 07-31-2012 07:12 AM

You can define for SSH in /etc/ssh/sshd.config whether anything should be inherited from the client environment with entries in AcceptEnv. Maybe it changed. Does the normal user already have the ability to execute programs form /sbin without specifying the complete path?


All times are GMT -5. The time now is 03:03 AM.