User Tools

Site Tools


unix:linux:sysadmin:syncusers

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
unix:linux:sysadmin:syncusers [2022/01/17 18:35] rodolicounix:linux:sysadmin:syncusers [2022/01/17 18:39] rodolico
Line 10: Line 10:
  
 It does **not** set the UID, and sets primary group to //users//. All users are members of the group sudo, which gives them sudo rights. See line in middle of sub addAUser to modify that. It does **not** set the UID, and sets primary group to //users//. All users are members of the group sudo, which gives them sudo rights. See line in middle of sub addAUser to modify that.
 +
 +The passwords are encrypted using the command <code bash>echo 'mypassword' | openssl passwd -1 -stdin</code> where 'mypassword' is the password you want to give the user.
  
 Use with caution, but it has worked well for us in the past. Use with caution, but it has worked well for us in the past.
Line 26: Line 28:
  
 # we use this to know to change usernames, in other words, if # we use this to know to change usernames, in other words, if
-# the username bre exists on the server, we need to change it +# the username user exists on the server, we need to change it 
-# to breena.+# to user1, while baduser is removed if it exists.
 # if the $changeTo is empty, we simply remove the user. # if the $changeTo is empty, we simply remove the user.
 my %fixUserNames = (  my %fixUserNames = ( 
Line 35: Line 37:
    );    );
  
-# 'password' comes from the command echo 'mypassword' | openssl passwd -1 -stdin+# 'password' comes from the command  
 +echo 'mypassword' | openssl passwd -1 -stdin
 # 'ssh key' is the value found in ~/.ssh/id_rsa.pub # 'ssh key' is the value found in ~/.ssh/id_rsa.pub
 +# in the following example, 'user1' is created if they don't exist,
 +# and their password is changed to 'mypassword' (encrypted version given).
 +# nothing is done to their ssh key.
 +# user2 is treated the same way, but their ssh public key is added to their authorized_keys file
 my %passwords = ( my %passwords = (
       'user1'  => {       'user1'  => {
-  'password' =>   '$1$hpr.bGjU$VgEWjkSIWZS.jlgxDRnCd0',+                         'password' =>   '$1$hpr.bGjU$VgEWjkSIWZS.jlgxDRnCd0',
  'ssh key'  =>   ''  'ssh key'  =>   ''
                      },                      },
unix/linux/sysadmin/syncusers.txt · Last modified: 2022/01/17 18:40 by rodolico