[solved] poweroff over ssh
#1
Sat, 2015-12-05 10:42
ronnysc
-
- Offline
- 2 years 3 months ago
- 2015-12-05
Hello,
is it possible to shut down the alpine system with "poweroff" over ssh? i haven't found a solution for it. As "root" working "poweroff" but not as user Login. But i don`t want to log in as "root" over ssh.
The Server isn't on the Internet only into my home net.
Best regards
Ronny
You can use "sudo" for such actions ;-)
ssh -p 22 -i ~/.ssh/id_rsa user@alpine-server 'sudo poweroff'
is it correct?
Yes, it should work. But you have to configure your sudoers file that you can use it without a password prompt.
Thanks. I'l try it next week. Now it's weekend ;).
Yes, it's working... I'm so happy.
What have i do:
1. edit the file sudoes
visudo
and insert 2 Lines:
Cmnd_Alias = SHUTDOWN_CMD = /sbin/poweroff
<your name> ALL=(ALL) NOPASSWD: SHUTDOWN_CMD
for "your name" insert the real name
2.
ssh -p 22 -i ~/.ssh/id_rsa user@alpine-server 'sudo poweroff'
and the server shuts down... perfect
thanks
Ronny