?
Solved

Add new user under NIS+

Posted on 2001-08-24
3
Medium Priority
?
412 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 400 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

Technology Partners: 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

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…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month12 days, 3 hours left to enroll

752 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