• Learning Map
  • Unix Quiz Center
  • Unix Professional Network
  • Just-Unix-No-Noise FB Group

unixadminschool.com

  • Home
  • Announcements
    • Feed
    • MISC
  • Beginners zone
    • Beginners Lessons
    • Career Guidance
  • Experts Zone
    • Cloud Computing
    • Configuration Solutions
    • Migrations
    • Network Design
    • Scripting
    • Server Security
    • SUN CLUSTERS
    • SUN LDOMS
    • Tools & Applications
    • Veritas Cluster Services ( VCS ) Learning
  • Intermediate Zone
    • Linux Learning
      • Linux Booting
      • Linux Disk Management
      • Linux LVM
      • Linux Networking
      • Linux Performance
      • Linux Troubleshooting
      • Linux YUM/RPM
      • Performance Analysis
      • Redhat Linux Kernel
      • RHEL 6
        • RHEL LDAP
        • Rhel6 Storage
      • Web Servers
    • Solaris Admin
      • Blog for Unix Admin
        • Storage Administration – SAN
      • Oracle Hardware
      • Reference Docs
      • Solaris 10 Zones & LDOMs
      • Solaris 11
      • Solaris Access Control
      • Solaris Best Practices
      • Solaris Booting
      • Solaris Disk Management
      • Solaris DNS
      • Solaris How-to
      • Solaris Installation
      • Solaris Kernel
      • Solaris Networking
      • Solaris NFS
      • Solaris NIS
      • Solaris Packages & Patching
      • Solaris Performance
      • Solaris Tips
      • Solaris Troubleshooting
      • Solaris User Authentication
      • solaris X86
      • Solaris ZFS and Boot Environment
      • Storage Configurations
      • SUN Hardware
      • Troubleshooting Flow charts
    • Veritas Admin
      • Veritas Netbackup
      • VxVM Learning
      • VxVM Troubleshooting
  • QUIZ Center
  • Vlabs
  • Unix Magazine

Subscribe

Solaris Troubleshooting NIS: add a user for NIS maps when passwd file is not in the /etc directory

Below procedure can be used to add a new NIS user when the passwd file is not in the /etc directory

Steps to Follow

The example below demonstrates how to add a user for NIS maps when the passwd file is not in the /etc directory.

The NIS directory is /etc/nisdir, where all the NIS maps reside.

Create a user in the /etc/passwd file. In this example, the new user is Johnl

Step 1.

Edit /etc/passwd to Add entry for the user

# vi /etc/passwd

Johnl:x:107:14:John l:/export/home/johnl:/bin/csh

Assign a password to the new user.

passwd johnl

Step 2:

Now run below command to create an entry in the shadow file

# pwconv

cat /etc/shadow file to see this entry in there.

johnl:dhXRywfkSELcE:10091::::::

Step 3:

Just copy the new entries to the /etc/nisdir/passwd file for passwd entry, and /etc/nisdir/shadow for shadow entry. To update the passwd map and push it to the slaves.

# make passwd

**NOTE**If you do not want this new user to be a local user, delete the entries in /etc/passwd and /etc/shadow.

You might be interested to read below :


  • SAN Storage Migration – Solaris with VxVM

  • Solaris host level SAN migration from Clariion to VMAX – Hands on Lab

  • Hands on Lab – Replacing Failed Disks from ZFS Pools ( RaidZ2 / RaidZ3 ) – Part2

  • Enabling SVM in Failsafe and password recovery in Solaris.

  • Hands on Lab – Replacing Failed Disks from ZFS Pools ( Simple / Mirrored / RaidZ )

  • Oracle Server Hardware Reference ( 3D View)
  • Email
  • More
  • Print
  • Digg
Posted by Ramdev
8 Comments
Tagged with: [ add, nis, nis maps, NIS user, Solaris Troubleshooting ]
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

8 Comments on “Solaris Troubleshooting NIS: add a user for NIS maps when passwd file is not in the /etc directory”

  • Sukhbir Singh
    30 September, 2011, 4:10

    Hello dear
    its good but not clear copy which entry to which file like from passwd to which file and from shadow to which file or only one entry is sufficient

  • Ramdev
    30 September, 2011, 4:20

    Hello Sukhbir.

    entry “Johnl:x:107:14:John l:/export/home/afzal:/bin/csh” from /etc/passwd to /etc/nisdir/passwd and entry “johnl:dhXRywfkSELcE:10091::::::” from /etc/shadow to /etc/nisdir/shadow.
    hope this helps

  • Sukhbir Singh
    30 September, 2011, 5:10

    Thanks Ram
    its now clear
    Thnx a lot
    Have a good day……….

  • Ravi
    7 October, 2012, 7:33

    why pwconv here

  • Ramdev
    7 October, 2012, 15:01

    @ravi, Since we added the new user by manually editing the /etc/passwd, we want to get the corresponding entries in /etc/shadow with pwconv command. Alternatively we can edit the /etc/shadow for the entries without using the pwconv.

  • Gavin Reid
    19 February, 2013, 13:29

    Thats a very messy way , take a look at Perl an Unix::PasswordFile modules :

    heres my password reset scripts for an example :

    #!/usr/bin/perl -w
    use Unix::PasswdFile;
    my $PASSWORDFILE = “/var/yp/src/passwd”;

    use strict;
    unless (@ARGV >= 1) 
    {
            print “\nBetter if you supply a username !\n”;
            exit ;
    }
    # now generate the random password and get the forgetful user name
    chomp(my $ranpass= `/usr/sfw/bin/openssl rand -base64 6`);
    chomp(my $user= shift);

    #open the password file 
    my $pw = new Unix::PasswdFile $PASSWORDFILE;
    if (!defined $pw->user($user))
    {
            print “\n try to supply a valid username …. moron\n”;
            print “\n now we are all laughing at you .hahahaha \n”;
            exit ;
    }
    $pw->passwd($user,$pw->encpass($ranpass));
    $pw->commit() or die “cant commit passwd files changes :$1″;
    # Rebuild NIS maps
    print “\nBuilding NIS maps…\n”;
    system(“cd /var/yp && /usr/ccs/bin/make”);
    print “\n\n————— CUT and SEND to USER ———-\n”;
    print “Your password has been reset\n”;
    print “Username:          $user\n”;
    print “Password:          $ranpass\n”;
    print “\n ——————–END CUT ——————-\n”;
     

  • Ramdev
    19 February, 2013, 14:30

    Thanks Gavin for providing the script, really appreciate your time.

Trackbacks

  1. business tips make mones web service

Leave a Comment

Join to our Professional Network (of 1400+ unixadmins ) to receive Unix Administration and Job Updates -

Pages1

Don't Miss Updates

 

Beginners Zone

 

Unixadmin Careers

Server Hardware

Beginners Lessons

Troubleshooting-Flowchart

 

Intermediate Zone

 

Solaris Booting

Solaris Volume Manager

Storage Configurations

Solaris Networking

Solaris X86

Solaris ZFS

Solaris NFS

Solaris NIS

Solaris Patching

Solaris Booting

Solaris Kernel

Veritas Volume Manager

Solaris NIS

Logical Volume Manager

Linux Networking

Linux Disk Management

Linux Troubleshooting

 

Experts Zone 

 

Solutions

Scripting and Automation

Server Security

Veritas Cluster Services

Sun Cluster Services

Cloud Computing

SUN LDOMS

Copyright © 2009 unixadminschool.com. All rights reserved.
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.