Problem with su -

David Quigley selinux at davequigley.com
Mon Mar 5 18:10:19 UTC 2012


On 03/05/2012 12:35, Bob Goodwin wrote:
> On 05/03/12 11:35, David Quigley wrote:
>>
>> Ok so for some odd reason root's home directory isn't labeled 
>> properly. You can see this by typing ls -Z in / and seeing that /root 
>> is labeled default_t and then checking what it should be by typing 
>> matchpathcon /root. Did you have SELinux disabled at any point? If so 
>> you might want to relabel your entire system (" and reboot). If not 
>> just type restorecon -Rvv /root and it should fix up all of the labels 
>> properly.
>>
>> Dave
>>
>
>        Ok, I looked at the things you suggested and yes it was as you 
> said.
>
>        I have never disabled SELinux on either of these computers, 
> not
>        even run in permissive.
>
>        I did restorecon -Rvv /root and then things appeared to work
>        normally again except for the strange prompt "bash-4.2#"
>
>        So the I did the "touch /.autorelabel" and rebooted, the
>        computer churned through a massive effort relabeling and when 
> it
>        finally settled things seem to work normally except I still 
> get
>        that strange prompt "bash-4.2#" when it has always been
>        "[root at box6 bobg]#."
>
>        I guess it doesn't matter since this is what I see when I
>        investigate:
>
>            [bobg at box9 ~]$ pwd
>            /home/bobg
>
>            [bobg at box9 ~]$ su
>            Password:
>            bash-4.2# pwd
>            /home/bobg
>
>        So I guess I still have root permissions as user bobg; it's 
> just
>        the prompt display that's changed now, an insignificant [I 
> hope]
>        mystery.
>
>        Thanks for your help,
>
>        Bob

The difference between su and su - is which environment is used. su 
assumes the environment of the person who typed su. su -  will reload 
roots bashrc and bash_profile. Its possible that one of those two has a 
different prompt export in there. I'd recommend checking that.

Dave


More information about the users mailing list