Solved

Add new user under NIS+

Posted on 2001-08-24
3
401 Views
Last Modified: 2013-12-27
I asked about adding groups and got an excellent response. Now I need the other part.  I'm running Solaris 5.6 with NIS+ and need to add a new user.  The suggestion was to install Solstice, but I'm not able to do that at this time.  If I could get the nistbladm command to add a user, I would be very appreciative.
0
Comment
Question by:jlargent
  • 2
3 Comments
 
LVL 40

Expert Comment

by:jlevie
Comment Utility
Adding a group is trivial compared to adding a user. And that's because there are other things that must be done in addition to just the passwd/shadow tables, like auto_home and credentials. Installing Solstice and using either the GUI or its command line interface is really the way to go.
0
 
LVL 38

Accepted Solution

by:
yuzh earned 100 total points
Comment Utility
Hi  jlargen,

     As I mention to you in the other question,  you should install solstice on your system, sinece you don't have it on hand at the moment, you can you the nis+ command to do it in the hard way, I hope that you still remember nisls, niscat, and nistbladm command.

    You need to su as root on your NIS+ master server, and do the followings:

    1.  Find an available user ID and user name  (the 1st field and the 3rd number, not on the following command out put).

      niscat passwd.org_dir | sort -t : -k 3 | more

    2. decide where the user's home dir is located, which server and its mount point on all boxes.

     3.  user the following script to add a user:

      we assume that the user's passwd = hello123
      and we'll change it later.

      save this script as nisaddusr , and set the permission as excutable.
cd to where the script is.

      ./nisaddusr user-name user_ID
      When the script prompt you for the passwd, just type in hello123.

=========================================================
   
#!/bin/sh
 #
 # script to create a new NIS+ user
 #
 # arguments --> username=arg1, uid=arg2
 #
 if test $# -eq 0
 then
   echo "addnis+user username uid"
   exit 1
 fi
 #
 set -x
 DNAME=`domainname`
 #
 # add user to passwd table (password="hello123")
 #
 nistbladm -a name=$1 passwd="SZ63.is3qsDOM" uid=$2 gid=10 shell=/bin/sh  home=/export/home/$1 passwd.org_dir
 #
 # disallow world read on this table entry
 #
 nischmod w-r [name=$1],passwd.org_dir
 #
 # create user credentials
 #
 nisaddcred -p $2 -P $1.$DNAME. local
 nisaddcred -p unix.$2@$DNAME -P $1.$DNAME. des
 #
 # change the table entry's owner to the user
 #
 nischown $1 [name=$1],passwd.org_dir
 #
 # end

  =========================================================

  4. Add the users home dir infor to auto_home.org_dir.
nistbladm -a key=${USERNAME} value=server:/export/home/${USERNAME} auto_home.org_dir

   5. reset the user passwd:
   nispasswd user-name
   change the credential for the user:
   nisaddcred -r $NAME.your-domain-name your-domain-name
   nisaddcred -p unix.${USRID}@your-domain-name -P ${NAME}.your-domain-name des

   6. You can find more information about NIS+ on the following website:
      http://www.eng.auburn.edu/users/rayh/solaris/NIS+_FAQ.html

   Cheers!

============
yuzh
   

     
       
0
 
LVL 38

Expert Comment

by:yuzh
Comment Utility
hi jlargen,,

    The script I gave to you yesterday, the user's group ID is set as staff
(10).

   You can modify the script to make it allow you to set the user to any group, and make the gid as 3rd command line arg.

   change:
 # add user to passwd table (password="hello123")
 #
nistbladm -a name=$1 passwd="SZ63.is3qsDOM" uid=$2 gid=10 shell=/bin/sh  home=/export/home/$1 passwd.org_dir
                       
   To:
nistbladm -a name=$1 passwd="SZ63.is3qsDOM" uid=$2 gid=$3 shell=/bin/sh  home=/export/home/$1 passwd.org_dir

   Regards
==============
yuzh
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now