DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 18th January 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,143
Thanked 182 Times in 149 Posts
Default OpenBSD: create user sh script

A couple of years ago I got tired of the interactive adduser(8) to create the the couple of user accounts, which I always use on OpenBSD.
The following, part of an install.site script, now automatically takes care of this.

Code:
#!/bin/sh

# ----------------------------------------------------
echo ADDING USERS

DEBUG=''
#DEBUG=echo 

#---------------------------
create_user() {
   local NAME PASSWORD UID
   NAME="$1"
   UID="$2"
   PASSWORD="$3"
   echo Creating user: ${NAME} 
   $DEBUG useradd \
        -m \
        -g ${NAME} \
        -G wheel,operator \
        -k /etc/skel \
        -d /home/${NAME} \
        -s /bin/ksh \
        -L staff \
        -p ${PASSWORD} \
        -u ${UID} \
        -g =uid \
         ${NAME} 
}

# password created with : $ echo MySecretPassword | encrypt -b8
# or                    : $ encrypt -b8 -p

create_user j65nko 1001 '$2a$08$vY3HJJAJhzAZ6yTbVxK5U.71cGBwDB6B4J/bwHmUNaa.laozj1yai' 
create_user robert 1002 '$2a$08$AU69JhvTJf1/KxFBl/7ZM.8pg.SN.Z1Hx8uh1uRE2j1oWht4XqjOK'
create_user john   1003 '$2a$08$s8aW6AbI1Z8D5o0SVKODA.JySV70MuQYZm9oSGua0MLz0V7Qw9eDe'
create_user snap   1004 '$2a$08$YyNR1QBLxsEupg0MZqhWtuNbjC4hr0fiZ5pN6dwxePmUi4xVRCFNi'
Study useradd(8) to understand the options. Consult encrypt(8) for info about encrypting the passwords.
__________________
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
  #2   (View Single Post)  
Old 18th January 2010
milo974 milo974 is offline
Fdisk Soldier
 
Join Date: Jul 2008
Posts: 58
Thanked 0 Times in 0 Posts
Post thank's 10/10 !

All your guides are very good !
Why do not try to write a small guide with this following content ?

Table of Contents
Upcoming Changes in OpenBSD 4.6
Post-Installation Tasks
Time & Date
Installing Software
User Management
System Diagnostics
Backup & Restore
System Management
Networking
Updating and Upgrading
Scripting

It would be very useful for beginners OpenBSD Admin...
Thank's
Reply With Quote
  #3   (View Single Post)  
Old 18th January 2010
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,143
Thanked 182 Times in 149 Posts
Default

Thanks for the friendly words and encouragement.

But with the broad range of subjects you mention, it will not be a small guide, but a book. Just have some patience, there are still quite a lot of guides in my pipeline.
__________________
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
  #4   (View Single Post)  
Old 31st January 2010
ohauer ohauer is offline
Port Guard
 
Join Date: May 2008
Location: germany
Posts: 32
Thanked 2 Times in 2 Posts
Default

Quote:
But with the broad range of subjects you mention, it will not be a small guide, but a book
Hey, why not?
I have the feeling It will be a good one (hopefully there is a pocket version).
The book can become a competitor/successor of BSD-Hacks or OpenBSD-Security.
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
HOWTO: mounting an USB device as normal non-root user in OpenBSD J65nko Guides 4 24th December 2008 01:43 AM
How to Run K3B with normal user openBSD 4.4 mfaridi OpenBSD General 6 12th November 2008 10:25 PM
Create a script to rmove oldest files disco Programming 5 14th July 2008 09:25 PM
Tried to create new partition using sysinstall but change is not permanent disappearedng FreeBSD General 7 6th July 2008 10:00 PM
Customizeable FTP auto-fetch script (OpenBSD snapshot download as example) J65nko Guides 2 1st June 2008 03:29 AM


All times are GMT. The time now is 02:59 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