Network Information  «Prev  Next»
Lesson 9Changing maps on the server
ObjectiveAdd a new user to an NIS database.

Changing Maps on Server

Sometimes the system administrator needs to make changes directly on the NIS server. For example, if the administrator wants to create a new user account, he or she must add appropriate records to the NIS maps. The simulation below demonstrates this procedure on a Linux machine. The processes and commands are essentially the same on other flavors of UNIX.
Change Map 1
1) Change Map 1
Change Map 2
2) Change Map 2
Change Map 3
3) Change Map 3
Change Map 4
4) Change Map 4
Change Map 5
5) Change Map 5
Change Map 6
6) Change Map 6
Change Map 7
7) Change Map 7
Change Map 8
8) Change Map 8
Change Map 9
9) Change Map 9
Change Map 10
10) Change Map 10
Change Map 11
11) Change Map 11
Change Map 12
12) Change Map 12
Change Map 13
13) Change Map 13
  1. You are logged on to the NIS server as root and are in the /home/user1 directory. Using the vi program, you are going to add a new user to the NIS database. This involves editing the passwd file, then creating a new NIS map. Change to the /var/yp/ypfiles directory, which is the directory that contains passwd.
  2. Change directories
  3. cd /var/yp/ypfiles
  4. Type cd /var/yp/ypfiles
  5. Use vi to open the passwd file.
  6. Open a file in vi,
  7. vi passwd
  8. Type vi passwd
  1. You can enter a new user, just as you would in the /etc/passwd file. Type the following user information after the last line in this file: pgrant::105:10:Paul Grant:/home/pgrant:/bin/bash Normally, you would press the Esc key plus ZZ to save your changes and exit vi. For the purpose of this simulation, press the Enter key on your keyboard to continue.
  2. Enter user information
  3. pgrant::105:10:Paul Grant:/home/pgrant:/bin/bash
  4. Type pgrant::105:10:Paul Grant:/home/pgrant:/bin/bash

Adding a new user to an NIS database

Here are the steps you followed to add a new user to an NIS database and change the NIS map:
  1. You are logged on to the NIS server as root and are in the /home/user1 directory. Using the vi program, you are going to add a new user to the NIS database. This involves editing the passwd file, then creating a new NIS map. Change to the /var/yp/ypfiles directory, which is the directory that contains passwd.
  2. Use vi to open the passwd file.
  3. You can enter a new user, just as you would in the /etc/passwd file. Type the following user information after the last line in this file:
    pgrant::105:10:Paul Grant:/home/pgrant:/bin/bash
    
    .
    Normally, you would press the Esc key plus ZZ to save your changes and exit vi. For the purpose of this simulation, press the Enter key on your keyboard to continue.
  4. The next step is to make your NIS server aware of this new user. You do this by running the make program. First, you must run this from the /var/yp directory. You are now in the
    /var/yp/ypfiles directory.
    

    Type cd .. to change to the /var/yp directory.
  5. Run the make program to recompile the NIS map.
  6. You now have a new NIS map. Verify that you have created a new map by typing ypcat.
  7. You can now see the new username. Notice that NIS placed this username in alphabetical order. This is because the ypcat program is not reading the /var/yp/ypfiles/passwd file. It is reading the NIS map itself. Now, add a password by typing yppasswd pgrant.
  8. The user pgrant has no password. Press the Enter key on your keyboard.
  9. Give pgrant a new password: manager1.
  10. The new password you have assigned is 8 characters, the minimum in NIS. If you type a password that is too short, yppasswd will reject it. Now, confirm the new password by retyping it.
  11. You now have created a new user and assigned her a password. The user is free to change this password, as soon as she logs on.