shell: Connect to correct machine for shutdown/restart

Ouch.

Fixes #1196
Closes #1199
Reviewed-by: Stef Walter <stefw@redhat.com>