The configuration below is in my /etc/sudoers:Defaults    !visiblepwDefaults    always_set_homeDefaults    env_resetDefaults    env_keep =  COLORS EDITOR DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORSDefaults    env_keep += MAIL PS1 PS2 QTDIR USERNAME LANG LC_ADDRESS LC_CTYPEDefaults    env_keep += LC_COLLATE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGESDefaults    env_keep += LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONEDefaults    env_keep += LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITYDefaults    secure_path = /sbin:/bin:/usr/sbin:/usr/binWhen I sudo su my PS1 terminal changes to the system default; ignoring my .bashrc PS1 setting. How can I fix this so that the environment variables are not lost when sudo suing?Weird; it's exporting EDITOR but it's not exporting PS1 for some reason; it's like it's being forcefully overridden; how can I stop this?When I run sudo -V the variables to keep PS1 is listed; it's not listed in the variables to remove.
sudo not preserving PS1
sudo
Don't use sudo su. It's an abuse/useless use of su. The proper equivalent is sudo -s.If you want to preserve environment variables, you want sudo -Es.If you find that $PS1 is still changing, you likely have a script doing it. You can find out where by doing sudo -Es $SHELL -x and reading through the output.