You are not logged in.

#1 2017-06-20 22:18:05

Melab
Member
Registered: 2014-11-05
Posts: 17

Shutdown/reboot from console-based login screen

My Arch Linux setup does not have a GUI installed nor do I wish to install one. I'd like to be able to shutdown/reboot my computer from the login screen. There was some thread on this site that was similar to my question and one (suggested?) solution was to setup user accounts like "poweroff" and "reboot" whose login shells corresponded to the paths of those executables. I can't find the thread and the solution was not explained very clearly. I tried making a reboot accounts, removed its password in /etc/shadow (so I could login to it without a password), set its UID to 900, added it to sudo, and changed its login shell to /usr/bin/reboot. I trued logging into so my computer would reboot, but the login screen kept saying it couldnt login ("wrong password" it said?). How do I do this right?

Offline

#2 2017-06-20 22:37:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: Shutdown/reboot from console-based login screen

Melab wrote:

removed its password in /etc/shadow

That was completely the wrong way of doing that.  You use `passwd` to set the password.  You can set it to an empty string, but that is different from not having a password - and even more different from breaking /etc/shadow by manually editting it.

There are tools to fix the /etc/{passwd,shadow,gshadow}{,-} files, but the easiest solution at this point would probably be to remove that user (properly with userdel) and start again.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-06-21 02:06:12

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,793

Re: Shutdown/reboot from console-based login screen

Would not running passwd shutdown   (or whatever the user was called) as root repair the problem?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Online

#4 2017-06-21 10:31:44

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,532
Website

Re: Shutdown/reboot from console-based login screen

Would it?  I'm not sure.  Usually once one manually breaks one of the user/password related files in /etc/ it's a bit more of a hassle.  Although given that the password is the only problem passwd may fix it - it's worth a shot.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2017-06-21 13:26:48

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: Shutdown/reboot from console-based login screen

After fixing the password issue wouldn't it be easier to set the shell to bash and then use ~/.bash_profile to call shutdown/reboot? It would ensure systemd would do its magic and there would be a session running so there would be no need to mess with sudo/polkit/whatever or give special privileges to the accounts. Obviously this assumes a local login, for remote logins you might have to tweak polkit not to ask for the password (I don't know what it will do if there is no password or the password is empty).


R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

Board footer

Powered by FluxBB