Using NIS-ypmatch, ypcat, Lname, Gname to get username/key


 
Thread Tools Search this Thread
Operating Systems Linux Using NIS-ypmatch, ypcat, Lname, Gname to get username/key
# 1  
Old 10-07-2004
Using NIS-ypmatch, ypcat, Lname, Gname to get username/key

Hello,

We can get the full info by typing:

ypmatch username passwd

aaaa : yyyy: ... ... : LastName Gname : ... ...

However, I'd like to know how could we get the username based on LastName and Given name please?

Thanks a lot,
ly
# 2  
Old 10-07-2004
I don't think you can - if you list the keys for that map, it will be the first entry of each line (the username).

You can ypcat the file (ypcat passwd) and grep for the Last/Given Name and then print the first field (username) with awk.
# 3  
Old 10-07-2004
do

ypmatch username passwd | awk -F: '{print $5}'
# 4  
Old 10-07-2004
Thanks a lot!

Combining and getting the command:

ypcat passwd | grep "Last name First Name" | awk -F : '{print $5}'

is exact what I am looking for.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Ypmatch

I cannot use my id in ypmatch. wats is the use of this. to whom I need to check it out to get done ypmatch ssmfkfaliases ypmatch: can't match ssmfkf. Reason: no such map in server's NIS domain (1 Reply)
Discussion started by: ramkumar15
1 Replies

2. Shell Programming and Scripting

Shell scripts exits after executing ypmatch

Hello - I have a script which creates a NIS user on Solaris machine. Before creating the user I check if the user being created laready exists or not using ypmatch and use $? to get the exit code. If a user exists, I get 0, works fine. However when the user is not found, the shell scripts exits by... (1 Reply)
Discussion started by: manju--
1 Replies

3. Solaris

ypcat ipnodes not working

When I try to get ipnodes it says "no such map in server's NIS domain" but for other maps its working. Then my query is if map is not there why it shows the entry when I "ypcat -x" adroit:/home/seo/hitendra 37 ] ypcat -x Use "passwd" for map "passwd.byname" Use "group" for map... (1 Reply)
Discussion started by: hiten.r.chauhan
1 Replies

4. UNIX for Advanced & Expert Users

NIS username max lenght

Hi I want to know the maximum length of user name under NIS? I tried googling but it didnt help :(. If there is any command to find out this please let me know. I know on unix user name should be 8 characters long but just i want to know if i can have 9 letter user under mapped under NIS. (1 Reply)
Discussion started by: zedex
1 Replies

5. Shell Programming and Scripting

ypcat group, ypcat passwd

When i run the following command on our server ypcat group or ypcat passwd I get list of groups and users respectively. I am not sure whether this list is only for the groups or users on the particular server on which i executed the command or all the groups and users on all the servers in... (2 Replies)
Discussion started by: pinnacle
2 Replies

6. Shell Programming and Scripting

ypmatch,ypcat,NIS

Hi I am moving from shell scripting part to network shell scripting. Can some one give me basic idea for all network related commands like ypmatch,ypcat,NIS etc... Documentation wiil be highly appreciated (1 Reply)
Discussion started by: siquadri
1 Replies

7. Shell Programming and Scripting

Validating that the NIS and NIS+ services are disabled

I'm creating a scrip for auditing our AIX box's to ensure that they are built according to our system standards. I'm not sure on the logic for checking to see if the NIS and NIS+ services are disabled. any idea's? (2 Replies)
Discussion started by: sport
2 Replies

8. Solaris

How to configure a NIS client bound to the NIS server in another subnet?

Hi, all. I have a Solaris client here needs to bind to NIS server in another subnet. Following is the configuration i made on the client, 1) edit /etc/inet/hosts to add an entry of the NIS server -- nserver01 2) execute `domainname` to set local NIS domain to the domain of the NIS server.... (1 Reply)
Discussion started by: sn_wukong
1 Replies

9. UNIX for Advanced & Expert Users

SUSE 9 and 10 NIS clients with RedHat 8.0 NIS server not working

We have a RedHat 8.0 NIS master, with a RedHat 8.0 NIS Slave. We also have a small number of SUSE 9.1 and SUSE 10 machines here for evaluation. However, no matter what i do, the SUSE machines will not talk to the NIS Servers. If i broadcast for NIS Servers for the specified NIS domain, it... (1 Reply)
Discussion started by: fishsponge
1 Replies

10. UNIX for Dummies Questions & Answers

NIS map mail.aliases specified, but NIS not running

Hi all, I just took over the admin role from someone and I wanna setup sendmail (just to send mail from the host) however, after I config all the resolv.conf, nssitch.conf, hosts file and when I try to send a mail out, after I punched ctl-D, it returned he following, "NIS map mail.aliases... (2 Replies)
Discussion started by: stancwong
2 Replies
Login or Register to Ask a Question