Thursday, March 19, 2015

Create User in Linux from Bash Script


To create user in Linux system use below script.



root@nirmal-desktop:~# vim userscript.sh

#!/bin/bash
for USER in test1 test2 test3 test4
do
useradd  -s /bin/bash $USER
mkdir -p /home/$USER
chown $USER:$USER -R /home/$USER
PASSINPUT=`echo $USER|cut -c1-3`123
echo "$USER:$PASSINPUT" | chpasswd
echo "$USER successfully created "
done




##################### Enjoy ########################

No comments:

Post a Comment

Installing Jenkins on RHEL 8 is a straightforward process. Here's a step-by-step guide

Introduction  Jenkins is an open-source automation server widely used for continuous integration (CI) and continuous delivery (CD) pipelines...