Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 106087

Hard time with shell command to shutdown Imac

$
0
0

hello,
I am trying to shutdown my Imac through a shell command. I first tried:

ssh -i /config/ssh_keys/id_rsa user@192.168.2.239 "shutdown -h now"

I was getting the message “Not a super user”.
Of course it didn’t work as I had to use sudo.

So I gave up this method as I don’t want to login as root … (and you can’t pass root password over command line)

Then I found out that I can call osacript from command line but I am having hard time with quotes.

If I login to Imac and then run:

osascript -e 'tell app "System Events" to shut down'

It works! Imac shuts down without asking for a password! Bingo!

But when I try to run it from command line it doesn’t! :frowning:

ssh -i /config/ssh_keys/id_rsa user@192.168.2.239 osascript -e 'tell app "System Events" to shut down'

Any help will be very appreciated!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 106087

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>