DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 12th December 2010
wesley wesley is offline
Real Name: Wesley
Fdisk Soldier
 
Join Date: Aug 2009
Location: Reunion Island
Posts: 76
Thanked 1 Time in 1 Post
Default script add user with encrypted password

Hi,

I try to write a batch file to add a user or multiple users with encrypted passwords in the batch.

What i have done :
encrypt yeti
give me -> $2a$06$dY6sS5vY1l7xD/CXHH2ezuMK5TVUiqEkmDvYUBJct9/Zfksjcm97C

So i try it in my batch :
useradd -c "YETI" -d /home/yeti -m -s /bin/ksh \
-p $2a$06$dY6sS5vY1l7xD/CXHH2ezuMK5TVUiqEkmDvYUBJct9/Zfksjcm97C \
-G users,wheel yeti

The problem, when i launch the batch file, shell give me the value of $2 of my encrypted password, how can i fix it ?
Thanks
Reply With Quote
  #2   (View Single Post)  
Old 12th December 2010
wesley wesley is offline
Real Name: Wesley
Fdisk Soldier
 
Join Date: Aug 2009
Location: Reunion Island
Posts: 76
Thanked 1 Time in 1 Post
Default

... sorry, i found it
just use \ before all $..
thanks
Reply With Quote
  #3   (View Single Post)  
Old 12th December 2010
ocicat ocicat is offline
Administrator
 
Join Date: Apr 2008
Posts: 2,935
Thanked 190 Times in 160 Posts
Default

Quote:
Originally Posted by wesley View Post
I try to write a batch file...
Minor nit.

The Microsoft world refers to commands placed into a file for automated execution as batch files. The Unix world refers to the same files as scripts. Most likely the difference is because Microsoft for most of its existence had limited control of execution flow built into its command processors, plus Microsoft had a strong alliance to IBM.

In contrast, the Unix world has traditionally integrated richer languages into its shells since early in its history.
Reply With Quote
  #4   (View Single Post)  
Old 14th December 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,254
Thanked 182 Times in 149 Posts
Default

Quote:
Originally Posted by wesley View Post
Hi,

I try to write a batch file to add a user or multiple users with encrypted passwords in the batch.
I posted such a script in
http://www.daemonforums.org/showthread.php?t=4221
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Encrypted == secure? passthejoe OpenBSD Security 13 9th November 2010 05:45 PM
Cannot change user password mzainal OpenBSD General 1 1st July 2010 05:27 AM
OpenBSD: create user sh script J65nko Guides 3 31st January 2010 08:29 PM
Encrypted disk compatibility issue TheLogicInverter FreeBSD Security 3 30th January 2009 02:59 PM
Enforce a better user password policy anomie Guides 8 7th November 2008 09:10 PM


All times are GMT. The time now is 05:09 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick