Solved

Add new user under NIS+

Posted on 2001-08-24
3
409 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.

691 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