VMware Cloud Community
kalex
Enthusiast
Enthusiast
Jump to solution

adduser via cli

Hey,

i'm trying to add a user via cli and running into a problem.

i use this command:

adduser username -p password

command completes successfully but user is unable to login

but if after i create a user with that command and then do this:

passwd username

password

password

after this command completes, same user is able to login.

Any ideas?

Thanks

Alex

0 Kudos
1 Solution

Accepted Solutions
Michelle_Laveri
Virtuoso
Virtuoso
Jump to solution

By design. Users created this way are automatically disabled by the system...

If you use kickstart scripts to automate your installation you can create users from the command-line using Md5 encryption like this:

useradd -p '$1$5a17$In5zYe6YsCty76AycpGaf/' -c "Mike Laverick" lavericm

where the long string represents the password. Users created this way are enabled by default...

Regards

Mike

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com

View solution in original post

0 Kudos
5 Replies
Michelle_Laveri
Virtuoso
Virtuoso
Jump to solution

By design. Users created this way are automatically disabled by the system...

If you use kickstart scripts to automate your installation you can create users from the command-line using Md5 encryption like this:

useradd -p '$1$5a17$In5zYe6YsCty76AycpGaf/' -c "Mike Laverick" lavericm

where the long string represents the password. Users created this way are enabled by default...

Regards

Mike

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
0 Kudos
kalex
Enthusiast
Enthusiast
Jump to solution

Thanks Mike

exactly what i was looking for.

is there tool that would let you create MD5 encryption so i can choose different password than password Smiley Happy

thanks

alex

0 Kudos
Michelle_Laveri
Virtuoso
Virtuoso
Jump to solution

Never really looked for a method...

I create a user - set the password - and then look for the md5 hash in the /etc/passwd file...

I did a quick look and found this:

http://webnet77.com/cgi-bin/helpers/md5.pl

Perhaps that would help?

Regards

Mike

Regards
Michelle Laverick
@m_laverick
http://www.michellelaverick.com
virtech
Expert
Expert
Jump to solution

Not sure if this is the best method, but you can use the folllowing command on your ESX server to generate a new MD5 password.

/sbin/grub-md5-crypt

http://kbase.redhat.com/faq/FAQ_44_573.shtm

0 Kudos
henrydenhengst
Contributor
Contributor
Jump to solution

I got the same problem.

user: /sbin/grub-md5-crypt

got the password returned, and copy pasted into the suggested commandline..

/usr/sbin/useradd -p '$1$JYg0L$BJkXKAnvSP1yGGcn9lXMg/' -c "Admin Global" AdminGlobal

Result: Can NOT get into the system on this account.

0 Kudos