-   Linux - Newbie (
-   -   ssh session (

bkone 10-16-2007 06:01 PM

ssh session
When you are in a ssh session how can you tell if in fact you are using ssh? Is there a way to tell the difference? Different prompt or something?

unSpawn 10-16-2007 06:27 PM

There's some variable's set starting with SSH_. Execute for example this in a Bash shell:

[ -z "${SSH_CONNECTION}" ] && echo "NOT using ssh."
Could mod /etc/bashrc to make the prompt include a visual marker, not that hard.

lugoteehalt 10-17-2007 11:29 AM

It's a good idea to have different coloured prompts for different boxes, you brought it up:

PS1="\[\033[1;35m\]\u@\h:\[\033[0m\]\[\033[1;34m\]\w\[\033[0m\]\[\033[1;35m\]$\[\033[0m\] "
Change 1;35 and 1;34 to vary the colours. For example put: PS1="\[\033[1;33m\]\u@\h:\[\033[0m\]\[\033[1;34m\]\w\[\033[0m\]\[\033[1;33m\]$\[\033[0m\] " on the other computer.

Poetics 10-17-2007 03:34 PM

Going along with lugoteehalt's suggestion, I often have the box name in my prompts.

For example, at home I have the following prompt (which I am likely to migrate to my work environment):

__[user@computer pwd]__

All times are GMT -5. The time now is 06:21 AM.