RHEL 5 Default $PATH

Latest response

To satisfy security requirements, I need the default, out-of-box configuration for the root user's $PATH. Basically I need to configure the root user's executable search path to match how the vendor (RedHat) ships it. Does anyone have this information?

Thanks.

Responses

If you look at the rootfiles RPM (# rpm -ql rpm -qf /root/.bash_profile), you'll see:
/root/.bash_logout
/root/.bash_profile
/root/.bashrc
/root/.cshrc
/root/.tcshrc

If you do "rpm -qV rpm -qf /root/.bash_profile" and the results are other than null, you can use yum to download the rootfiles RPM, then use rpm2cpio to extract the files from that RPM and then replace the current dot-files in /root with what's in the RPM.

You might also want to verify that /etc/profile hasn't been altered (#rpm -qV rpm -qf /etc/profile) and fix as necessary

-tom

rpm -ql rpm -qf /root/.bash_profile gets me:
error: file /etc/profile.d/rpm: No such file or directory

Can you explain that command a bit? Why do you use "rpm" twice? I'm not sure I understand what the command is supposed to do.

Also, given that I don't recall changing the $PATH at all, would it be possible for someone to post the results of an "echo $PATH" with the default settings? It's possible my scan is getting me a false reading. If so, it would be nice to compare my settings to a known default.

Thanks for your help!

Bleah: the discussions formatting system apparently eats back-ticks. Normally, you can nest the execution of commands inside the another command by using back-ticks:

rpm -ql `rpm -qf /root/.bash_profile`

The other option is to use $() formatting (this will be dependent on the shell used. BASH, KSH and other extended bourne shell derivatives use this method). Thus, you can also use:

rpm -ql $(rpm -qf /root/.bash_profile)

instead of using back-ticks

Neat trick using rpm -qf to feed back the package name to rpm.. will steal that for future use :D

Depending on the shell-implementation, the $() method is even better than the back-tick method: you can nest the $() constructs (at least with KSH93 on some OSes you can) whereas, with the back-tick method, you can only go one deep.

I regularly use $(), and would suggest it for the nesting benefits... just using it with rpm to get the package then feed that back to get additional package details is a nice touch ;)

Tom,

You could simplify this even more to:

rpm -qlf /root/.bash_profile

Thanks for the shortcut: I'd never bothered to see if l/f were compatible flags. Old habits from Solaris/IRIX days die hard.

Hi Sal.

rpm -ql rpm -qf /root/.bash_profile

It might be that browsers delete the back quote from the view

So you can do it in two steps

1) rpm -qf /root/.bash_profile
rootfiles-8.1-6.1.el6.noarch

Version will differ for RHEL5

2) rpm -ql rootfiles-8.1-6.1.el6.noarch
/root/.bash_logout
/root/.bash_profile
/root/.bashrc
/root/.cshrc
/root/.tcshrc

output will be al most the same.

Regards,

Jan Gerrit