Solved

Add new user under NIS+

Posted on 2001-08-24
3
408 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Expert Comment

by:jlevie
ID: 6424267
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
ID: 6427715
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
ID: 6430631
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…
Suggested Courses

734 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