You are not logged in.

#1 2009-11-24 05:33:13

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

su/sudo and terminal PS1 [Solved]

When you run "su -" or "sudo -i" where does it get the settings for bash PS1?

And how do I change it?

1110351753200911231259040612579x391scrot.png

Last edited by anonymous_user (2010-02-07 02:46:10)

Offline

#2 2009-11-24 05:42:55

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: su/sudo and terminal PS1 [Solved]

You can change it in /root/.bashrc

I also was wrestling with this the other day because the .bashrc that doesn't seem to help when you login to a tty shell.  for that I had to add something like this to /etc/profile:

if [ "`whoami`" = "root" ]; then
    lpath="/root/bin"
    PS1="\[\e[31;40m\]\u:\w# "
else
    lpath="/home/`whoami`/bin"
    PS1="\[\e[32;1m\]\u:\w$\[\e[0m\] "
fi
export PS1
PATH="$lpath:/bin:/usr/bin:/sbin:/usr/sbin"
export PATH

(Yes, I left the red color on root open because I like all of root's text output to be in red.)

Offline

#3 2009-11-24 05:50:12

IgnorantGuru
Member
Registered: 2009-11-09
Posts: 640
Website

Re: su/sudo and terminal PS1 [Solved]

Also with sudo I think you need to add an env_reset to /etc/sudoers

Defaults env_reset,rootpw

Offline

Board footer

Powered by FluxBB