Page 1 of 1

ssh and server side scripting

Posted: 2008/09/27 21:04:14
by LoyGlenn
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.

Re: ssh and server side scripting

Posted: 2008/09/27 22:17:18
by NedSlider
Only if the client has a rDNS entry as the only info the server see's is the connecting IP address.

Re: ssh and server side scripting

Posted: 2008/09/30 20:12:59
by LoyGlenn
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.

ssh and server side scripting

Posted: 2008/10/01 13:38:30
by gerald_clark
Try 'who --lookup -m'

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