Jump to content
Sign in to follow this  
Dean Plude

Adding new users the easy way

Recommended Posts

Yeah .. its the easy method by far :)

 

# useradd -d /home/$1 -m -k /etc/skel -g users -G audio,video -s /bin/bash $1

 

That's what I use, please note this isn't perfect for all systems, some might not have the groups I add.

 

Also when I'm setting up accounts (multiple) I normally use the -p option to allow me to set a default password.

 

# crypt.pl somewonderfulpassword
eBX9jzU8Bjlmo
# useradd -p eBX9jzU8Bjlmo ...... etc .... $1

 

The crypt.pl is a nice simple bit of perl:

#!/usr/bin/perl -l
$password = shift;
@salt = ('.', '/', 0 .. 9, 'A' .. 'Z', 'a' .. 'z');
print crypt $password, join '', (@salt)[rand 64, rand 64];

 

;)

Share this post


Link to post
Share on other sites

Yo znx,

 

Nice tips, however don't you think: # crypt.pl somewonderfulpassword is abit insecure

as this will be logged in the .bash_histroy if your using bash?

Share this post


Link to post
Share on other sites

Well what I did there was an example, normally I do all that from a script, where $1 is the input ...

# useradd -p `crypt.pl $1` .... $1

 

So simply setup an account with user/pass the same .. :) Also if you are doing this as root (which I'd assume you are) then you would be in control of the account as it was and able to reset the password to anything you wanted! eheh

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...