creating user account in Linux

In Ubuntu

sudo useradd -c mishrark -d /home/mishrark -m -g users mishrark

sudo passwd mishrark

In CentOS

  1. Creating user account inside /opt/phd Directory

sudo useradd -c rkm -d /opt/phd/rkm -g users rkm

  1. Change password :

sudo passwd rkm

Enter password

  1. Creating user account inside /opt/bits2020 Directory

useradd -c 2020A7PS0239U -d /opt/bits2020/2020A7PS0239U -g users 2020A7PS0239U

sudo passwd rkm

Enter password

Multiple User Account

  1. Create a file with name of uids2021

2021A1PSXXX1U

2021A1PSXXX2U

2021A1PSXXX4U

2021A1PSXXX5U

2021A1PSXXX8U

2021A1PSXXX7U

2021A1PS0221U

2021A1PSXX77U

2021A1PSXXX8U

2021A1PSXXX9U

2021A2PSXXX5U

2021A2PSXXX8U

2021A2PSXXX5U

2021A2PSXXX7U

2021A2PSXX51U

2021A2PSXX72U

2021A2PSXX44U

2021A2PSXX48U

2021A3PSXX55U

2021A3PSXX88U

2021A3PSXX17U

2021A3PSXX40U

  1. run the below script

for i in `cat uids2021`

do

useradd -c $i -d /opt/bits2021/$i -g users $i

done

  1. Add Password

for i in `cat uids2021`

do

echo $i:a

done