Just started learning how to use both linux and centos.
I tried every method to give a user I created root privileges, such as...
- visudo -> username ALL=(ALL) ALL
- usermod -a -G wheel username
and more...
but I just couldn't get it to work...
Can someone please teach me how to do it?
How do I even give a user root privileges?
Re: How do I even give a user root privileges?
If you give someone sudo rights then they need to prefix their intended command with `sudo ...` - e.g. sudo usermod -a -G wheel username
And if you add a user to group wheel then the default configuration on CentOS 7 already allows them to run anything sudo so there's no need to add an entry specifically for their username.
And if you add a user to group wheel then the default configuration on CentOS 7 already allows them to run anything sudo so there's no need to add an entry specifically for their username.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: How do I even give a user root privileges?
Hi TrevorH,TrevorH wrote: ↑2018/09/07 07:57:47If you give someone sudo rights then they need to prefix their intended command with `sudo ...` - e.g. sudo usermod -a -G wheel username
And if you add a user to group wheel then the default configuration on CentOS 7 already allows them to run anything sudo so there's no need to add an entry specifically for their username.
I didn't know I had to prefix 'sudo' in order to use root command lines. Thanks for letting me know. However, I'm confused about the second paragraph you mentioned. Did you mean 'sudo' is not required if I add a user to group wheel?
Re: How do I even give a user root privileges?
The 'sudo' (Do as SuperUser) is a command that executes other command as root.
E.g. "sudo foo" does (almost) same as if root had run "foo".
The 'sudo' is required.
There is "sudoers" configuration that sets, who can use the 'sudo'.
A default rule there says: all members of 'wheel' can use sudo.
When you did "usermod -a -G wheel username", the 'username' became able to sudo.
When you did "visudo -> username ALL=(ALL) ALL", the 'username' became able to sudo.
Now you have two rules that allow the user to sudo. One would be enough.
PS. The default config is in file /etc/sudoers. The 'visudo' edits that file.
Your command did add a line to that file. However, there is directory
/etc/sudoers.d for additional config files. The visudo can be told to use
such file.
(Additional sudo-rules can be in external databases, like LDAP.)
The benefit of separate file is that your custom rules are not inside a file that
might change when the sudo-package is updated.
E.g. "sudo foo" does (almost) same as if root had run "foo".
The 'sudo' is required.
There is "sudoers" configuration that sets, who can use the 'sudo'.
A default rule there says: all members of 'wheel' can use sudo.
When you did "usermod -a -G wheel username", the 'username' became able to sudo.
When you did "visudo -> username ALL=(ALL) ALL", the 'username' became able to sudo.
Now you have two rules that allow the user to sudo. One would be enough.
PS. The default config is in file /etc/sudoers. The 'visudo' edits that file.
Your command did add a line to that file. However, there is directory
/etc/sudoers.d for additional config files. The visudo can be told to use
such file.
(Additional sudo-rules can be in external databases, like LDAP.)
The benefit of separate file is that your custom rules are not inside a file that
might change when the sudo-package is updated.
Re: How do I even give a user root privileges?
Thanks for the reply. Now I know the 'sudo' is always required unless I'm logging as root.jlehtone wrote: ↑2018/09/07 20:00:22The 'sudo' (Do as SuperUser) is a command that executes other command as root.
E.g. "sudo foo" does (almost) same as if root had run "foo".
The 'sudo' is required.
There is "sudoers" configuration that sets, who can use the 'sudo'.
A default rule there says: all members of 'wheel' can use sudo.
When you did "usermod -a -G wheel username", the 'username' became able to sudo.
When you did "visudo -> username ALL=(ALL) ALL", the 'username' became able to sudo.
Now you have two rules that allow the user to sudo. One would be enough.
PS. The default config is in file /etc/sudoers. The 'visudo' edits that file.
Your command did add a line to that file. However, there is directory
/etc/sudoers.d for additional config files. The visudo can be told to use
such file.
(Additional sudo-rules can be in external databases, like LDAP.)
The benefit of separate file is that your custom rules are not inside a file that
might change when the sudo-package is updated.
Also, I appreciate that you added useful information in P.S., but I don't get how this thing(sudoers/sudoers.d) works lol...