I accidentally installed this system with root password login and I would rather use sudo.
Google suggested that the correct method was to disable the root account and set privileged users as Wheels. When I tried to follow the method described in the documentation; i.e.;
EDITOR=kate kdesu visudo
I responded to the login box and no editor appeared. Something is clearly missing from my setup. Any ideas what is wrong?
Depending on how you did the installation of Tumbleweed, not setting a root password isn’t an option with the legacy YaST-based installer; if you used the new Agama installer, that does provide an option to skip setting a root password.
Tumbleweed defaults to using the targetpw setting, which uses the target user’s password rather than the current user’s password. This is set in the sudoers file. Note that if you remove targetpw from the defaults, you also need to disable the line:
ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults targetpw'!
Otherwise any user on the system can run commands as root using their own password.
You can disable the root password by setting the root user login shell to /sbin/nologin.
You can also just remove root’s password using passwd -d root (as root), but if the system is configured to allow null passwords (done using the pam-config command), that would leave the root account accessible. IMO, changing the shell to /sbin/nologin is more reliable (of course, if someone has access to the system to change pam-config as well, then all bets are off either way).
Then knurpht’s suggestion for adding a file to /etc/sudoers.d will let you use your own user password to run commands using sudo, and root will be disabled.
This will effectively make it impossible to enter single user (or emergency) mode at the very least as well as breaking anything that attempts to run commands via user login shell (su which is so vehemently recommended over sudo on this forum).
Which is why there is such thing as locking user (passwd --lock)
An easy way to do what you want is to install one of these two packages:
S | Name | Summary | Type
---+-----------------------------+----------------------------------------------------+--------
| sudo-policy-sudo-auth-self | Users in the sudo group can authenticate as admin | package
| sudo-policy-wheel-auth-self | Users in the wheel group can authenticate as admin | package
Then you will not have to do any manual changes.
As far as I know these packages will take care of both sudo and polkit.
Your user should obviously be a member of the sudo or wheel group, depending on which package you install.