Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
different profile for remote vs local bash
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
slestak
Tux's lil' helper
Tux's lil' helper


Joined: 13 Jun 2003
Posts: 115

PostPosted: Thu Feb 19, 2004 8:52 pm    Post subject: different profile for remote vs local bash Reply with quote

Problem: Need to set stty and disable bash color only when external ssh.

Scenario:
3 workstations @ home all running gentoo. Workstation A has ssh port open to internet. From work I ssh into Workstation A, and then ssh to B and C to do my stuff.

Whatever workstation I'm on, (whether local or remote) I usually have an ssh connected to one of the other two.

I want color bash, screen, irssi, etc when I'm at home, but not from work.

When I do a who -u from A while external, I can see my work ip address.
The work ip address is not currently in an environment var or I would use it to trigger some login in ~/.bashrc.

To make it a little harder, when I go from work -> ssh A -> ssh B, i need workstation B to detect that I am remote and do same magic.

Anyone got some ideas to pull this off?
Back to top
View user's profile Send private message
axxackall
l33t
l33t


Joined: 06 Nov 2002
Posts: 651
Location: Toronto, Ontario, 3rd Rock From Sun

PostPosted: Thu Feb 19, 2004 10:26 pm    Post subject: Reply with quote

Code:

# set |grep -i ssh
CVS_RSH=ssh
SSH_CLIENT='192.168.0.3 39767 22'
SSH_CONNECTION='192.168.0.3 39767 192.168.0.1 22'
SSH_TTY=/dev/pts/1

It will give you some idea about last three variables (ignore the first one about CVS) you may want to use to identify where are you from.

But the sniplet above is just a hack, as ssh has nothing to do with your terminal properties per se. Originally Unix world used to read termcaps in order to customize your tty:
Code:

# echo $TERM
xterm

so you see that you run xterm with appropriate terminal properties. Or:
Code:

# echo $TERM
linux

and you see that most likely you are on local console.

Try infocmp to see your curent termcap/terminfo settings.

You may want to check Terminfo and Termcap (detailed) HOWTO or Text-Terminal-HOWTO for a bigger scope.
_________________
"Lisp is a programmable programming language." - John Foderaro, CACM, September 1991
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum