How to give Users SUDO Permission from Bash Script
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 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 Imtiaz |
Write a line like this to /etc/sudoers.d/$iuser:
Code:
$iuser ALL=(ALL:ALL) NOPASSWD: ALL |
Or even better, add a line to give a particular GROUP such permission and make sure your script adds them to that group.
There are clues in the sudoers file you are editing when you use visudo. The man page might also be useful. |
I am not sure what the point is of creating users that can not login but need sudo or root privileges.
|
I concur with michaelk, if this is a real word task then it definitely has wrong approach.
|
Good catch. These user cannot log in (shell is set to false) and sudo will only work from a logged in user session.
Perhaps you have not fully explained what you need, or have mis-stated the case. Please expand and explain so that we can understand what you are really trying to do. |
Quote:
|
All times are GMT -5. The time now is 05:42 PM. |