[RESOLVED] How to allow non-root user to shutdown
[RESOLVED] How to allow non-root user to shutdown
I currently have remote shutdown working fine as 'root' but I would prefer to create a new user 'remoteshutdown' to use for this instead of root. Problem is I cannot seem to find out how to allow a non root user permission to shutdown.
Edit:
Have tried changing group of /sbin/shutdown file to my 'shutdown' group but group of this file still remains as root.
Edit:
Have tried changing group of /sbin/shutdown file to my 'shutdown' group but group of this file still remains as root.
Last edited by NickC on 2014/10/16 15:46:21, edited 2 times in total.
Re: How to allow non-root user to shutdown
Use sudo
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: How to allow non-root user to shutdown
Was looking for a way to natively allow a non-root user to run shutdown. The idea is to have this run remotely over the network, if I need to use sudo then the root password will again need to be included in the batch/scrript file which is what I didn't want to do.TrevorH wrote:Use sudo
-
- Posts: 519
- Joined: 2012/06/26 14:20:47
Re: How to allow non-root user to shutdown
No it won't, sudo can be configured to run a command without the user's password (and never requires the root password.)
Re: How to allow non-root user to shutdown
If I use sudo do I need to change the remote script to include 'sudo' in the command? At the moment my remote script is:stevemowbray wrote:No it won't, sudo can be configured to run a command without the user's password (and never requires the root password.)
Code: Select all
plink.exe -ssh -root@Server1 -pw <password> "shutdown -h now"
-
- Posts: 519
- Joined: 2012/06/26 14:20:47
Re: How to allow non-root user to shutdown
Yes. First configure sudoers on Server1 so that the remoteshutdown user can run /sbin/shutdown without a password.
(man sudoers)
Then your remote command would be
(I would also advise you to set up a public/private key pair for ssh access rather than use a password.)
(man sudoers)
Then your remote command would be
Code: Select all
plink.exe -ssh remoteshutdown@Server1 -pw <password> "sudo shutdown -h now"
Re: How to allow non-root user to shutdown
Have tried many various edits of /etc/sudoers file but nothing seem to allow any account other than root to run the shutdown command. Is there not some other way of doing this other than sudoers file which doesn't seem to work.
Edit:
Have even tried changing group of shutdown command but for Centos does not seem to allow this to be done, no error message just doesn't have any effect.
Edit:
Have even tried changing group of shutdown command but for Centos does not seem to allow this to be done, no error message just doesn't have any effect.
Re: How to allow non-root user to shutdown
It would help if you detailed exactly what you did try...
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: How to allow non-root user to shutdown
All sorts of edits of 'visudo' tested but none worked, various error below:
"shutdown -h now" remotely returns error:
"sudo shutdown -h now" remotely returns error:
Logon via SSH as remoteshutdown user
"/sbin/shutdown /h now" returns error:
Try and make remoteshutdown user an 'Administrator'
Unable to unlock Settings -> Users
Use "su gnome-control-center user-accouts" workaround to do this.
Logon via SSH as remoteshutdown (with Administrator rights)
"/sbin/shutdown /h now" returns:
"shutdown -h now" remotely returns error:
Code: Select all
bash: shutdown: command not found
Code: Select all
sudo: sorry, you must have a tty to run sudo
"/sbin/shutdown /h now" returns error:
Code: Select all
Authentication is required for powering off the system.
Authenticationg as: <DifferentUser>
Unable to unlock Settings -> Users
Use "su gnome-control-center user-accouts" workaround to do this.
Logon via SSH as remoteshutdown (with Administrator rights)
"/sbin/shutdown /h now" returns:
Code: Select all
Authentication is required for powering off the system.
Multiple identities can be used for authentication:
1 . <DifferentUser>
2 . remoteshutdown
Choose identity to authenticate as
Re: How to allow non-root user to shutdown
That last one should work, as should the one before. It wants the password for the user in question not the root password.
Code: Select all
[trevor@xps13 plugins]$ /sbin/shutdown -r now
==== AUTHENTICATING FOR org.freedesktop.login1.reboot ===
Authentication is required for rebooting the system.
Authenticating as: trevor
Password:
==== AUTHENTICATION COMPLETE ===
[trevor@xps13 plugins]$ Connection to xps13 closed by remote host.
Connection to xps13 closed.
[/cpde]
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke