How to create users with admin priviledges?
Hello, I have 4 users on a LAMP server:
User1 User2 User3 User4 I would like to know how to set these users as admin. like in Windows. I'm root, but I want them to be able to perform administrative task such as making changes to Apache, MySQL, etc.. For MySql do I have to create a separate account for MySql or can they use the same login name? Thanks for your help |
It's called visudo and sudo.
|
Code:
sudo adduser User1 admin |
You have to run visudo first and uncomment the wheel group. Then you'll need to add the admin users to the wheel group in /etc/group. Afterward you can run any command using the sudo command.
|
Thanks ramram29 and aysiu. When I run "sudo adduser User1 admin" I get:
'The group admin does not exist' ramram29 I don't see andy wheel group here at the the visudo file, when I run the visudo command this is what I get: # /etc/sudoers # # This file MUST be edited with the 'visudo' command as root. # # See the man page for details on how to write a sudoers file. # Host alias specification # User alias specification # Cmnd alias specification # Defaults Defaults !lecture,tty_tickets,!fqdn # User privilege specification root ALL=(ALL) A I'm confused!! Thanks for your help |
add a group called admin and add the line
Code:
%admin ALL=(ALL) ALL |
I added the line: "%admin ALL=(ALL) ALL" using visudo, then when I ran the command "sudo adduser User1 admin" I got: The group 'admin' does not exist. Do I have to do addgroup admin as well??
Thanks... |
1. Uncomment or add the admin group to the sudoers file. As root type 'visudo'. It will enter the file in vi. In the sudoers file uncomment or add the group admin as '%admin ALL=(ALL) NOPASSWD: ALL'. Comment all the other lines. In Ubuntu the group is called admin and in Fedora and SUSE it's called wheel. Exit and save this file by pressing :wq.
2. Edit /etc/group and make sure the admin group contains the accounts that you want to have root priviledge. For example, admin:x:19:user1,user2,user3 Only add the users. The number 19 is the group number - you don't have to change the group number that is already there. 3. Logged in under any of these accounts you can then type the command 'sudo' followed by any command with root priviledge and it will let you run that command. For example, 'sudo shutdown -r now' will allow you to restart the system logged in as user1, who is a member of the sudoers group. |
ramram29 I did not see any admin I saw 'adm:x:4:' I placed the users here and I was able to do step 3 above. So I guess this is the solution.
Thanks.. |
If you where able to restart Linux as stated above then it should be working. To very, try to type the same root priviledge command using an account that is not a sudoer.
|
I created a temp acct. and when I try the same command I get prompted for a password.
Thanks ramram29 |
I know someone with the same nickname as you 'Cuco'.
|
But I'm cucolin@. Hey ramram29 evethough I made users with admin priviledges I still need to give them permissions for the files. I cannot make any changes with those users acct. to the /var/www files that I have there or some apache files.
Thanks |
Code:
sudo usermod -G admin username |
All times are GMT -5. The time now is 03:25 AM. |