- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- useradd.sam - not creating home dirs
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2008 08:35 AM
02-25-2008 08:35 AM
I have to add a large number of users to a system running hp-ux 11.11.
I've written a simple script that calls useradd.sam, because it allows me to assign a common password. The only downside is, it does not created the home directories.
Here is the command I am using:
/usr/sam/lbin/useradd.sam -m -u $NUID -p $PASSWORD -c "$FIRST $LAST" -s /usr/bin/ksh $USERNAME
I run the exact same command calling /usr/sbin/useradd, and the home dir is created, but I can't set the password.
Here are the defaults:
/usr/sam/lbin/useradd.sam -D
GROUPID 20
BASEDIR /home
SKEL /etc/skel
SHELL /sbin/sh
INACTIVE -1
EXPIRE
CHOWN_HOMEDIR yes
I am puzzled. Any ideas? Please let me know.
Thanks in advance!
Fred
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2008 09:10 AM
02-25-2008 09:10 AM
Re: useradd.sam - not creating home dirs
Interestinly, the 'useradd.sam' command is simply a symbolic link to '/usr/sbin/useradd'.
It would be useful to know the return code from the execution of the command both commands, too:
# /usr/sam/lbin/useradd.sam -m -u $NUID -p $PASSWORD -c "$FIRST $LAST" -s /usr/bin/ksh $USERNAME; echo $?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2008 10:01 AM
02-25-2008 10:01 AM
Re: useradd.sam - not creating home dirs
I noticed the same thing which is why I am so puzzled.
Both commands returned a 0, so the command is executing successfully.
/usr/sam/lbin/useradd.sam -m -u 115 -p $PASSWORD -c "test user" -s /usr/bin/ksh testme2 ; echo $?
0
ll -d /home/testme2
/home/testme2 not found
/usr/sbin/useradd -m -u 116 -c "test user" -s /usr/bin/ksh testme3 ; echo $?
0
ll -d /home/testme3
drwxr-xr-x 2 testme3 users 96 Feb 25 09:56 /home/testme3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2008 12:28 PM
02-25-2008 12:28 PM
SolutionAnd I too see the same behavior; viz. that using the symbolic link allows you to specify the '-p' switch whereas using the executable directly does not. This is in addition to the "side-effect" of not creating the home directories.
Thus, it seems that the underlying binary detects whether or not it is called by the name 'useradd.sam' or not. This is easily achieved when an executable calls 'realpath()' which discerns whether an absolute pathname names the same file or involves '.' or '..' characters or symbolic links.
A simple snippet of Perl code demonstates this:
# cat /tmp/somecode.pl
#!/usr/bin/perl
use Cwd qw(realpath);
my $who = realpath($0);
if ( $0 eq $who ) {
print "run as the real thing!\n";
}
else {
print "run as an alias!\n";
}
1;
# ln -s /tmp/somecode.pl /tmp/somecode
# /tmp/somecode
run as an alias!
# /tmp/somecode.pl
run as the real thing!
With regard to your case, it seems that you can't have your cake and eat it too.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2008 02:12 PM
02-25-2008 02:12 PM
Re: useradd.sam - not creating home dirs
Thanks for taking the time.
Fred
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2008 03:54 PM
02-25-2008 03:54 PM