I don't get why this error pops up every time I want to run the systemctl
commands. I know that I have to run it with sudo
, which runs just fine, but I am curious, why is this happening? It didn't happen before, and I didn't do anything special, other than configuring my /etc/ssh/sshd_config
file.
Before this happened, if I were to run systemctl
commands without sudo
, a text response would show, requesting the password for my user
But now, this request doesn't pop anymore! Why is that?d
user@machine:~$ systemctl restart sshd
Failed to restart sshd.service: Interactive authentication required.
See system logs and 'systemctl status sshd.service' for details.
And when I run the systemctl status sshd
command I get this error: Couldn't open /etc/securetty: No such file or directory
. What's this about?
By the way, I have Ubuntu 20.04 LTS on my machine.
user@machine:~$ systemctl status sshd
● ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2021-05-21 19:47:32 UTC; 2h 51min ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 14021 (sshd)
Tasks: 5 (limit: 38329)
Memory: 1.7G
CGroup: /system.slice/ssh.service
├─14021 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
├─20182 ssh-server new -c 256 -s -l LANG=en_US.UTF-8
├─20183 -bash
├─46248 systemctl status sshd
└─46249 pager
May 21 20:58:15 machine sshd[19925]: Disconnected from user user 217.138.209.001 port 2222
May 21 21:13:40 machine sudo[20203]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
May 21 21:13:49 machine sudo[20203]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
May 21 21:13:49 machine sudo[20203]: pam_unix(sudo:auth): authentication failure; logname=user uid=1000 euid=0 tty=/dev/pts/1 ruser=user rhost= use>
May 21 21:13:51 machine sudo[20203]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
May 21 21:13:55 machine sudo[20203]: pam_unix(sudo:auth): Couldn't open /etc/securetty: No such file or directory
May 21 21:38:02 machine su[34300]: pam_unix(su:auth): Couldn't open /etc/securetty: No such file or directory
May 21 21:38:05 machine su[34300]: pam_unix(su:auth): Couldn't open /etc/securetty: No such file or directory
May 21 21:38:05 machine su[34300]: (to root) robin on pts/1
May 21 21:38:05 machine su[34300]: pam_unix(su:session): session opened for user by user(uid=1000)
systemctl
commands withoutsudo
, but now this.systemctl
commands? Only some? Which ones? Finally, please also edit and tell us what operating system you are using.ssh
terminal? When you runsystemctl
withoutsudo
, it tries to usepolkit
to authenticate you.polkit
is thesudo
of the GUI world. The popup you describe is apolkit-agent
which does the front-end work. If you are runningsystemctl
in anssh
terminal, or another TTY which isn't running a display manager, it's not attached to any display ($DISPLAY
and$XAUTHORITY
) sopolkit
doesn't know whichpolkit-agent
to talk to and doesn't have the ability to interact with you via a GUI.su
. Here's a related answer regardingsu
. Also seesystemd
's dev's comments aboutsu