ssh and server side scripting

If it doesn't fit in another category, ask it here.
LoyGlenn
Posts: 6
Joined: 2008/09/27 20:53:23

ssh and server side scripting

Postby LoyGlenn » 2008/09/27 21:04:14

I am using Mandriva 2008.1 to connect via ssh to our server (CentOS). Is there a way to determine the computer name of my client from a server side script? Thanks, Loy.

NedSlider
Forum Moderator
Posts: 2886
Joined: 2005/10/28 13:11:50
Location: UK

Re: ssh and server side scripting

Postby NedSlider » 2008/09/27 22:17:18

Only if the client has a rDNS entry as the only info the server see's is the connecting IP address.

LoyGlenn
Posts: 6
Joined: 2008/09/27 20:53:23

Re: ssh and server side scripting

Postby LoyGlenn » 2008/09/30 20:12:59

Thanks for the reply - but i think i am going another route. I want to use a combination of the "w" and "tty" commands to determine which printer should be printerd to. Ex..
tty>xx to determine which session
w>xxx to determine from xx which ip address is associated with this session
setenv printer "ipaddress of my teminal for this session"

Which theoretically should work since all ip's are static here and i could name the printers attached toeach terminal after the static ip address. Does this look workable?
thanks, Loy.

gerald_clark
Posts: 10642
Joined: 2005/08/05 15:19:54
Location: Northern Illinois, USA

ssh and server side scripting

Postby gerald_clark » 2008/10/01 13:38:30

Try 'who --lookup -m'

IP=`who --lookup -m | awk -F"[()]" '{ print $2 }'`