If you don't want to (can't) make the remotes have a separate PS1
, then I'd say "no", it would be at least awfully difficult. Consider that on an SSH connection the local side has no real idea of what is a shell prompt and what is something else, and so setting colors for the prompt really has to come from the remote. You could set colors before starting the session, but they'd be effective for all output, that is until an ls
or an editor sets colors of it's own.
Of course you could come up with some wrapper for the session to detect everything looking like a prompt and to colorize it, but it would easily lead to false positives (color on every line with a $
?) and be awfully complicated compared to just dropping a single line to your .profile
or .bashrc
on each machine.
With a number of machines, it might be useful in any case to search for solutions to synchronize configuration changes on all of them. Be it some tool made for it, or just a script, or just running a loop to copy a (set of) config file(s) on them all.
Probably not. But back to it http://superuser.com/questions/33712/change-terminal-colors-when-connecting-to-remote-server-linux
– random – 2016-08-29T06:36:02.5671Why not make your terminal red (or some other color) so that when you connect to them you get a default white? – Reinstate Monica - ζ-- – 2016-08-29T14:58:26.537