and members of sudo can run any command.
root ALL=(ALL:ALL) ALL
sudo ALL=(ALL:ALL) ALL
Hi Everyone,
I have a fresh Debian 12.9 install. My user account is part of sudo
group, and members of sudo can run any command. However, I get an
error when trying to use sudo:
$ sudo ls
[sudo] password for jwalton:
jwalton is not in the sudoers file.
$ groups
jwalton cdrom floppy sudo audio dip video plugdev users netdev
bluetooth lpadmin scanner
$ su -
Password:
# grep -v -E '^#' /etc/sudoers | cat -s
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Defaults use_pty
root ALL=(ALL:ALL) ALL
sudo ALL=(ALL:ALL) ALL
I've rebooted the machine twice. I know the failure is not due to
stale login information.
Does anyone know why I cannot use sudo in this case?
Jeff
The straight, but blunt, answer here, I think, is to read the man
pages for sudo and sudoers
On Fri Feb 21, 2025 at 1:40 AM GMT, Tom Dial wrote:
The straight, but blunt, answer here, I think, is to read the man pages
for sudo and sudoers
In principle I agree with this advice but the sudoers manpage is
notoriously, famously inscrutable.
If you had to pick a man page to be inscrutable, this wouldn't be the
one.
On 21/2/25 09:40, Tom Dial wrote:"
The TL;DR here is that for maintaining personal workstations and servers it makes more sense to log in as root, do the work as required, then log out. Or there is "sudo -i" to get an interactive root shell and avoid prepending every command with "sudo.
Logging in as root on a server is highly dangerous, especially if it has an internet facing ssh port. The big cloud providers like AWS provision images where there is no root login, and any access requires a client certificate for a non root user.
The logged in user can sudo. However on some systems like Ubuntu derived, root user doesn't even have a password or a shell. So the first thing I do is
sudo passwd root
and work from there.
However, certificate based access using e.g. ssh-copy-id is a time-bomb. Best practice is a separate IAM mechanism with centralised access control. I personally use LDAP to maintain ssh public keys backed up by an authenticator on each host. I do notpermit root accounts in the IAM.
I've never used it myself; here on my single-user machine, I just su
to root.
I do understand, however, the usefulness of fine-tuning access to
privileged functionalities on a computer with multiple users.
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (0 / 16) |
Uptime: | 168:59:42 |
Calls: | 10,385 |
Calls today: | 2 |
Files: | 14,057 |
Messages: | 6,416,551 |