User Tools

Site Tools


linux:bash

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:bash [2018/07/23 09:10]
seanburns [Batch New Accounts]
linux:bash [2018/07/23 12:02]
seanburns [Batch New Accounts]
Line 122: Line 122:
         echo "$i":'complex_password' | chpasswd &&\         echo "$i":'complex_password' | chpasswd &&\
         passwd -e "$i"         passwd -e "$i"
 +done
 +</code>
 +
 +Another way:
 +
 +<code bash>
 +#!/bin/bash
 +
 +# modified based on a script written by Julia Tran, 2018 July
 +# name.txt contains a list of usernames only
 +# userpw contains a list of users and temp passwords in the following format: user1:password1
 + 
 +for i in $(cat name.txt) ; do
 +  useradd -mU "$i"
 +done
 + 
 +chpasswd < userpw
 + 
 +for i in $(cat name.txt) ; do
 +  passwd -e "$i"
 done done
 </code> </code>
linux/bash.txt ยท Last modified: 2018/07/23 12:02 by seanburns