HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

Confused with useradd.sam

 
Vivek Bhatia
Trusted Contributor

Confused with useradd.sam

Hi Guys,

Was looking for a way to create the useraccount in HP-UX with the password in the single command.

And the answer is useradd.sam ,in which we can give the encrypted passwd with -p option.

/usr/sam/lbin/useradd.sam

Now the question is how it actuly works coz it is calling the useradd command internally , then why the same option(i.e -p) do not work with useradd?

lrwxr-xr-x 1 root sys 17 Mar 30 2008 /usr/sam/lbin/useradd.sam -> /usr/sbin/useradd

Will wait for the Replies.

Thanks
Vivek Bhatia
9 REPLIES
Hakki Aydin Ucar
Honored Contributor

Re: Confused with useradd.sam

I think useradd.sam is a SAM based facility, and according to the base name "$0" of script ,it is controlled an if loop inside useradd to link sam tool .
Vivek Bhatia
Trusted Contributor

Re: Confused with useradd.sam

Hi,

Thanks for you reply. Is there anyone with some other opinion?

Thanks Guys,
Vivek Bhatia
AL_3001
Regular Advisor

Re: Confused with useradd.sam

Hey Vivek,

It should not be an issue assigning the password after the user is created, right?

However, choice is your's.

Cheers,
AL
Vivek Bhatia
Trusted Contributor

Re: Confused with useradd.sam

Hi AL,

I think you didnt understand my question properly.

Please read the Question at the Top.

Thanks for reply.

Regards,
Vivek Bhatia

Re: Confused with useradd.sam

>Is there anyone with some other opinion?

Of course not. Hakki said how the multiple hardlink/softlink trick works.
Matti_Kurkela
Honored Contributor

Re: Confused with useradd.sam

Hakki described it in terms of shell scripts, but actual program binaries can do the same thing.

Basically, the command will see the name used to start it, and can choose to work differently if a special name is used.

In the terminology of the C programming language, the program reads argv[0] and then uses it to decide what to do and how to interpret the rest of its arguments.

Many other groups of similar programs use the same trick; for example, gzip/gunzip/gzcat are often implemented by just one binary that does different things depending on the name used.

Also run "ll -i /sbin/vg*" in HP-UX: you'll notice that most/all vg* commands have the same attributes (permissions, size, date) and the same inode number, i.e. they are multiple hard links to the same binary.

MK
MK
Tingli
Esteemed Contributor

Re: Confused with useradd.sam

My guessing. useradd.sam can run useradd first to create the account. The it replace the encrypted password in file /etc/shadow.

Re: Confused with useradd.sam

>Tingli: useradd.sam can run useradd first to create the account.

Since useradd.sam IS useradd, there is no need for useradd.sam to talk about itself in the third person. :-)
Hakki Aydin Ucar
Honored Contributor

Re: Confused with useradd.sam

Vivek,

If you are satisfied with the answers you have received it would be appreciated if you would assign points:

http://forums11.itrc.hp.com/service/forums/helptips.do?#28