Score:0

Ubuntu 21.04 Broke Passwordless SSH Shutdown

us flag
Mmm

I recently had passwordless SSH shutdown and reboot working on Ubuntu 20.04, but after upgrading to Ubuntu 21.04 it no longer works.

I have key based authentication set up correctly, and can ssh into the Ubuntu 21.04 computer without a password. But my passwordless shutdown and reboot commands no longer work.

My /etc/sudoers file has the following as the last entry:

[USERNAME] ALL=(ALL) NOPASSWD:/usr/sbin/shutdown /usr/sbin/reboot

I have tried various iterations for the sudoers file that I found on the web (some of which have commas between the reboot and shutdown entries, some of which just say /sbin instead of /usr/sbin) but nothing works.

What I am doing wrong?

guiverc avatar
cn flag
Ubuntu 20.04 LTS is QA-tested to upgrade two ways; to the next release (ie. 20.10) OR *will be in the future* to the next LTS release (ie. 22.04 after 22.04.1 has been released). You've gone outside of those paths, so *testing* of your chosen path was on you. I'd suggest sticking to fully QA & supported paths for the best upgrades.
marosg avatar
vn flag
Don't try random advises from Internet. Check where shutdown and reboot reside, use that path. If you try `man sudoers` you will find they need to be comma separated
Mmm avatar
us flag
Mmm
guiverc - Canonical describes 21.04 as a "production quality" release and even though it is not LTS it is still within the support window. Also, I had no choice but to upgrade. Just bought a new CPU that was incompatible with 20.04. I needed the updated Linux kernel, so I had no choice but to upgrade. marosg - thanks for the advice. It fixed the problem.
guiverc avatar
cn flag
The 21.04 kernel stack is available for Ubuntu 20.04 LTS (at 20.04.3 machines using the HWE kernel stack use 21.04 stack; at 20.04.2 they used the 20.10 stack; users who opted to use GA stack remain on 20.04's *stable* kernel - selected at installed via menu or ISO used to install, but can be changed post-install anyway). Don't forget LTS releases offer two kernel stack choices! (also be aware dates on 20.04.3 eg. https://fridge.ubuntu.com/2021/08/27/ubuntu-20-04-3-lts-released/ apply to ISOs, installed systems upgraded ~fornight earlier)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.