Ask Your Question

How do i add a user to the sudoers list and can this be harmfull?

asked 2016-06-15 09:33:10 -0600

sigurdsk gravatar image

Hi! I want my user to be able to use certain commands that require administrative priviledges, but i dont want the user account to be an administer account. So i want to sudo some commands, but the user needs to be in a sudoers list..

edit retag flag offensive close merge delete


as root run: usermod -aG wheel sigurdsk

florian gravatar imageflorian ( 2016-06-15 16:20:05 -0600 )edit

WARNING: The wheel group effectively gives the user FULL root access (via sudo) - if that is appropriate, then add users as required - otherwise use the method described by @aeperezt.

snowolfe gravatar imagesnowolfe ( 2016-06-16 06:58:37 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-06-15 09:47:52 -0600

aeperezt gravatar image

If you add user to the wheel group it will have sudo access as administrative user, this means he will not be limitated to specific commands. If you want the user to have sudo for some specific commands then you have to edit your sudoers file and add, as sample you want the user to be able to restart or initialize services you can do something like

target_user_name ALL=NOPASSWD: /bin/journalctl,  /bin/systemctl

or if there are more than one user you can do for a group

%group_name ALL=NOPASSWD: /bin/journalctl, /bin/systemctl

That way user will be able to run those commands with no password and will be limited to them only.

Good Luck

edit flag offensive delete link more


Do not include the NOPASSWD: if you still want the user to type their own password to run the commands.

Commands run via sudo are recorded in the "audit logs" under the user name running them, not root - making track back of who-did-what much more meaningful than being logged as user root

snowolfe gravatar imagesnowolfe ( 2016-06-16 07:14:11 -0600 )edit

Question Tools

1 follower


Asked: 2016-06-15 09:33:10 -0600

Seen: 2,059 times

Last updated: Jun 15 '16