We have 4 nodes runing hp-ux HP-UX XX B.11.11 U 9000/800 ##
Each one of them has local user management. User generation it's done
via "SAM", so we wanted to make this quicker to admin.
I've thought about a script, wich seems to run perfectly on a normal
linux machine, but I'm not sure of how could it work, nor even it its
"safe" to do it in a HP-UX enviropment.
This is how I'd do it :
#!/bin/bash
#$1 = user name entry
# PASSWORD stores the encrypted password matching the username
PASSWORD = `slappasswd -h {MD5} -c '$1$%.8s' -s "$1" | cut -d} -f2`
useradd -d /opt/oracle/app/home/"$1" -m -g MYGROUP -p "$PASSWORD" "$1"
I can't find slappasswd, or expect in my system, so I don't know if it
would be safe to run this. Once It runs in a node I would send the
commands via ssh to all nodes involved.
If other options are avaliable, I don't want to rediscover what's
already done.
thanks & regards.
take a look at the command "/usr/sam/lbin/useradd.sam"
Thks.
It seems there isn't an option to insert the passwd with the useradd
command.
I'll keep working, hope I can automatize this.
Expect can be found here:
http://hpux.cs.utah.edu/hppd/hpux/Tcl/expect-5.43/
I use this to feed password resets to 'passwd' via an ssh session.
Thanks, I've seen expect working on linux so I think there will be no
problem.
keep working , still scripting.
re-read what I said....not "useradd" but "useradd.sam" from the SAM
tool
./useradd.sam
Either -D or user must be specified
Usage: ./useradd.sam [-p <passwd> [-u <uid> [-o]] [-g <group>] [-G
<group>[,<group...>]] [-d <dir>] [-s <shell>] [-c <comment>] [-m [-k
<skel dir>]] [-f <inactive>] [-e <expire>] <login>
Usage: ./useradd.sam -D [-g <group>] [-b <base dir>] [-f <inactive>] [-
e <expire>
Thanks , it was my fault, i saw the link and got confused, you are
right about it.
lrwxr-xr-x root sys useradd.sam -> /usr/sbin/useradd
keep working
ok...so does it suffice for your needs or not (as it does have the "-p
password" option)?
It was fine , but I'll still need to pass a MD5 pre-encrypted passwd,
and I didn't find the needed commands in my server.
Found this ins other sources :
http://www.circlingcycle.com.au/Unix-sources/add-batch-Unix-accounts.pl.txt
I'm trying to split it so I get what I need.
Thanks to you all!