nslookup for Unix


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users nslookup for Unix
# 1  
Old 06-15-2009
nslookup for Unix

I am connecting from windows via Putty to some other Unix server.
How can I display my current windows MachineName/NTID in putty?
Thanks Smilie
# 2  
Old 06-15-2009
if you have an interactive (ssh or telnet) session on the unix server -
Code:
nslookup mypc.mycompany.com

# 3  
Old 06-15-2009
Once you have SSH'ed you your Unix server you will have several variable set by the SHD daemin, one of the se is SSH_CLIENT, e.g.:
Code:
$ echo $SSH_CLIENT
192.168.2.4 58728 22
$

The IP address being where you SSH'ed from so you may automate getting the name of where you SSH'ed from thus:
Code:
MYPCIP=`echo ${SSH_CLIENT} | awk '{ print $1 }'`
MYPCNAME=`getent hosts ${MYPCIP} | awk '{ print $NF }'`

HTH

[/code]
# 4  
Old 06-16-2009
Hi,
Thanks for your reply..
getent hosts ${MYPCIP} | awk '{ print $NF }' : this is not working.

Moreover, "getent" is not working on some OS.
Can you tell me why is it not working? Is it working for your Windows PC?
# 5  
Old 06-17-2009
getent is available for FreeBSD, Solaris and Linux, can't vouch for other Unixes; no it is available for Windows as far as I know.

The getent is run on the Unix machine to get the name of the PC you SSH'ed from, so your PC has to be listed in either DNS or the /etc/inet/hosts file on your Unix machine.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

nslookup command

hi, I am new in Solaris 10 , i am installing a software in solaris 10, while performing pre requisite nslookup command should return without error, and the IP address and host should match those listed in the etc/hosts file, but nslookup command show the below error , can anybody tell me how i... (4 Replies)
Discussion started by: zeeshan047
4 Replies

2. Emergency UNIX and Linux Support

Nslookup!!! Please look up!!!

Hi all Nslookup command returns!!!! Code: nslookup 10.91.44.29 Server: 127.0.0.1 Address: 127.0.0.1#53 29.44.91.in-addr.arpa name = station1.example.com Code: nslookup station1.example.com Server: 127.0.0.1 Address: 127.0.0.1#53 Name: ... (4 Replies)
Discussion started by: anishkumarv
4 Replies

3. Shell Programming and Scripting

nslookup: am I doing it right?

Hi guys, I'm back to get some help again :) I have a file that has a list of IP addresses, and I use nslookup in my script to resolve hostnames of those IPs. the problem I'm facing is that I not all the hostnames got resolved! and I don't know why. sometimes the same duplicate IP returns a... (8 Replies)
Discussion started by: Abdulelah
8 Replies

4. Solaris

Further nslookup options if any !!

Hi , I have a requirement to find the aliases by doing an nslookup on the Cname. If i do an nslookup on the alias name i get the Cname , but i need the cname from alias name. eg: Hostname = acb.example.com Virtual name= abcvirtual.example.com nslookup abcvirtual.example.com will... (3 Replies)
Discussion started by: mpics66
3 Replies

5. Shell Programming and Scripting

nslookup output

Hi All, If I give the hostname followed by nslookup, I get the output like below, commandprompt>nslookup efgh Using /etc/hosts on: xyz looking up FILES Trying DNS Non-authoritative answer: Name: abcd Address: 47.47.47.47 Aliases: efgh I am not sure on the bolded ones. Can... (4 Replies)
Discussion started by: Rajakct84
4 Replies

6. IP Networking

nslookup strangness

hi, what would cause the nslookup to work one way but not the other? for most machine it works both ways. >nslookup 172.18.10.235 Server: 172.16.17.3 Address: 172.16.17.3#53 235.10.18.172.in-addr.arpa name = machine1.prod.local >nslookup machine1 Server: ... (3 Replies)
Discussion started by: purest
3 Replies

7. UNIX for Advanced & Expert Users

nslookup problem

I am having trouble configuring BIND 8.3 on Solaris 9. When I run nslookup, I get this error/message: test# nslookup *** Can't find server name for address 192.168.1.31: Non-existent host/domain *** Default servers are not available I double checked everything and I can't figure this out. I... (8 Replies)
Discussion started by: xnightcrawl
8 Replies

8. Shell Programming and Scripting

NSLOOKUP script

Hi Anyone know of a quick and simple way to script an NSLOOKUP's from a list/text file? Thanks, Gav (1 Reply)
Discussion started by: gavcollins
1 Replies

9. UNIX for Dummies Questions & Answers

nslookup on linux ???

Hi I usually use solaris but Im working right now with a Linux box and I cannot find the nslookup command. Does Linux use this command or have an other one to do dns querys?? Thanks and sorry for such a dumb question.. :) (2 Replies)
Discussion started by: piltrafa
2 Replies

10. UNIX for Advanced & Expert Users

named and nslookup

Guys , Am using Linux - Red Hat 6.1 . My DNS and nslookup command was working fine and ppl. can resolve through this server . but i changed something in /etc/named.conf , that stopped the DNS . The named proccess is working , but nslookup command is not , i get this error message : ... (3 Replies)
Discussion started by: tamemi
3 Replies
Login or Register to Ask a Question