Article 5GSAC How to give Users SUDO Permission from Bash Script

How to give Users SUDO Permission from Bash Script

by
imtiaza
from LinuxQuestions.org on (#5GSAC)
Dear Gurus,

I have found a link (Bash Script) through which we can create Users in Linux. Problem is all the Users created from this script does not have SUDO Permission (root Permissions). Please help, Which and Where I can add the switches/option so that when i execute below Script it create ALL USERS with SUDO permission.

Code:#!/bin/bash
# NOTE: Be sure to run this script with sudo.

# Read user and password
while read iuser ipasswd; do

# Just print this for debugging.
printf "\tCreating user: %s with password: %s\n" $iuser $ipasswd

# Create the user with adduser (you can add whichever option you like).
useradd -m -s /bin/false $iuser

# Assign the password to the user.
# Password is passed via stdin, *twice* (for confirmation).
passwd $iuser <<< "$ipasswd"$'\n'"$ipasswd"
done < <(paste users.txt passwords.txt)
I just want to know that if i run the above mentioned script it create the users and password from the files (user.txt and passowrd.txt) but did not gave them SUDO permission. I want the script to give users SUDO permission.

Thanks
Malik Adeel Imtiazlatest?d=yIl2AUoC8zA latest?i=ofAcPR-zhM4:8hP1AfYWrNY:F7zBnMy latest?i=ofAcPR-zhM4:8hP1AfYWrNY:V_sGLiP latest?d=qj6IDK7rITs latest?i=ofAcPR-zhM4:8hP1AfYWrNY:gIN9vFwofAcPR-zhM4
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments