Solved

Add new user under NIS+

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to check for shares on aix 1 81
Linux :how to provide sudo access to the user 13 97
Cygwin VIM in WIndows 2007: Unable to copy text to Windows 10 65
aix unix tar error 3 67
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
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 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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

809 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