You are not logged in.
Question:
Is it possible to have the color theme change in terminal when logging into a remote server, and maybe also when su into root on my local machine?
Baggrund
I'm trying to setup a wireless access point (without much success) and I ssh a lot into my access point. But once a while I run the a command in the wrong terminal window (on my local machine instead of my access point or visa versa).
Wish
I have looked around, but can only find info to change the coloring in general. If someone knows whenever it is possible and maybe also have a link where I can find instructions (for a linux-noob user) I be very happy.
Safe Config
--lallepot
Offline
Install and check out the xtermcontrol options and write a little script that changes your local xterm to another color on ssh login. Something like this:
#!/bin/bash
xtermcontrol --fg yellow --bg blue &
ssh -l $1 $2
Save under any name, e. g. foo, make executable and call with
./foo loginname remotehost
Obviously you have to use xterm for this to work, but I guess other x-terminal-emulators have similiar features.
Offline
You, of course, can set an alias in your .bashrc to ssh that calls foo. It will hide the normal ssh command.
Offline
I find that setting the prompt colour/style helps alot on that problem too. If you search for bash prompts, you will find alot that changes depending on the user and ssh or not.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
Thx Captain Spaulding and Mr.Elendig. -- I'll take a look on the info ASAP (as I have been a bit busy the last couple of days).
Offline
Take a look at http://www.linuxselfhelp.com/howtos/Bas … TO-12.html, specifically the section 12.5 Prompt Depending on Connection Type. You would put this in the ~/.bashrc on the remote machine. I've got mine set up to have a green connection for ssh and red for root.
Offline
If I'm understanding you right, why can't you just change the colors on your access point's prompt? Or even change the look of the prompt. That's how I tell all my computers apart. Likewise, putting a .bashrc (or .zshrc, or whatever) in /root will let you make that prompt distinct.
EDIT: I guess you want even more colors changes?
Last edited by pauldonnelly (2007-05-05 22:59:00)
Offline
I just want the colors to change depending on which computer I'm logged into (local or remote) and also depending on which user I'm logged as (fx white as lallepot, red as root).
But as I am pretty new 'still' to linux, I a bit lost on what to do. The only info I could find before starting this thread was regarding changing the terminal colors in general (id. files blue, folders green).
So I was and still am interested in knowing
1) if the colors could be change depending on computer and users
2) links or info on how to do it
Offline
So I was and still am interested in knowing
1) if the colors could be change depending on computer and users
2) links or info on how to do it
Do you want to change the text color and background color across the board in your terminal, or would you just like to make the prompts look different? I think the former will depend on the terminal you are using (one solution has already been posted). The latter is pretty simple.
Assuming you are using Bash, you can change the look of your prompt in your .bashrc file. Since each user on each computer can have their own $HOME/.bashrc, it's easy to make them all have a different look. For example, my laptop uses a prompt that looks like 0~% (the return code of the last command, my current directory name, and a percent sign). My desktop looks like {paul@paal:~} $ ({username@hostname:directory} dollar sign). The prompt colors are also different (teal and green, respectively). The upshot is that if I ssh into my desktop, I can tell whether I'm looking at that remote terminal or a local one. I have a unique prompt on my brother's server and my older machine too, so I can tell them from the other two. Root accounts also have a .bashrc (in /root), so they can get the same treatment. Any tutorial on Bash prompt customization will tell you how to do this. You just have to customize the prompt for each user. The thing I really like about this is that I get the same prompt whether I'm using my laptop locally or log into it remotely, no matter where I log in from. It's always teal and succinct. I think I'd get confused otherwise.
PeteMo posted another method for getting color coded prompts. The big advantages of that method, as far as I can tell, are that it's not necessary for users to customize their prompts by hand in order to identify them, and it tells users whether they are local, using ssh or telnet, and whether they are root on top of that. It lives in the system-wide /etc/bashrc file, so that any user without a personal ~/.bashrc will get it as the default.
Offline