View previous topic :: View next topic |
Author |
Message |
slestak Tux's lil' helper
Joined: 13 Jun 2003 Posts: 115
|
Posted: Thu Feb 19, 2004 8:52 pm Post subject: different profile for remote vs local bash |
|
|
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 |
|
|
axxackall l33t
Joined: 06 Nov 2002 Posts: 651 Location: Toronto, Ontario, 3rd Rock From Sun
|
Posted: Thu Feb 19, 2004 10:26 pm Post subject: |
|
|
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:
so you see that you run xterm with appropriate terminal properties. Or:
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 |
|
|
|
|
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
|
|