You are not logged in.
Pages: 1
Hi, I recently needed to use su to run a program that requires privilege (doesn't work with sudo) and I realized that all my settings were set for my main account, so when I run su I don't have any colored windows, alias, etc... Is there a way to create alias and color settings for root account without conflict with my main account ?
Also I couldn't start gedit after typing su...why is that? I don't understand...
thank you.
Offline
Offline
Presumably you are referring to your shell settings; create a rc file for root.
gedit is a graphical programme, you need to use gksu, or something like that.
# edit: too slow: falcon in NC!
Offline
Offline
Hi trixrabbit,
basically, there's two ways of invoking su:
$ su
will spawn a non-login root shell
$ su -
will spawn a login root shell.
Check out the man page for your shell to see how login and non-login invocation scenarios differ. If you are using GNU bash, for example, you should carefully read the "INVOCATION" section of the man page. You'll see that when invoked as a login shell, bash (citing manpage) "looks for ~/.bash_profile, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable." If it is not invoked as a login shell, it reads and executes commands from ~/.bashrc.
Common practice is to source ~/.bashrc from ~/.profile or ~/.bash_profile, and you can find such an example of bash config in Arch's /etc/skel/ directory. You could do something like:
# cp /etc/skel/.bash* /root
then edit /root/.bashrc and add set your custom environment, aliases, etc. for the root user there.
For GUI apps: when using "su -" under X, it will forget your DISPLAY variable, so you have to set it again manually, and probably use xhost(1) to allow X clients that you start as root to connect to your (regular user's) X server, but I guess it's better to use sudo or gksu or something. Everything else about running X apps as superuser is explained on the wiki page karol pointed to.
Offline
Pages: 1