Stefan G. Weichinger
2020-Dec-22 08:29 UTC
[Samba] Shutting down a remote PC via "net rpc"
Am 17.12.20 um 10:14 schrieb Stefan G. Weichinger via samba:> Am 16.12.20 um 12:59 schrieb Michael Howard via samba: >> On 16/12/2020 11:36, Michael Howard via samba wrote: >>> On 16/12/2020 09:55, Stefan G. Weichinger via samba wrote: >>>> Am 14.12.20 um 19:17 schrieb Stefan G. Weichinger via samba: >>>>> >>>>> >>> net rpc shutdown -C "MESSAGE" -t 60 -f -I HOSTNAME >>> -UAdministrator%'PASSWORD' -W DOMAIN >>> >>> Works for me here from the command line, from a bash script and the >>> same script from cron. The tested PC is Windows 10 Ent. The only >>> quoting used is on the password as it contains a pipe sign, amongst >>> other non alphabetics. >> >> .... obviously the 'message' is in double quotes. > > Looks nearly like my try. I had the whole 'user%pw' quoted. We'll try > that variation, thanks.Still no success. I upgraded to samba-4.12.10 now (thanks, Louis), just in case. I know it should not be an issue, but I wonder if the "//" in the password somehow is a problem when called from within the bash script. We will test another password soon, just to see what happens. And maybe "#!/bin/sh" ... I still don't see why it works from the bash and not in the script (we need it as cron job in the end).
On Tue, 2020-12-22 at 09:29 +0100, Stefan G. Weichinger via samba wrote:> > And maybe "#!/bin/sh" ... I still don't see why it works from the > bash > > and not in the script (we need it as cron job in the end).That will be it. /bin/sh and /bin/bash are quite different on Debian- based systems. Use #!/bin/bash and it should be much more like your interactive shell. Andrew Bartlett -- Andrew Bartlett (he/him) https://samba.org/~abartlet/ Samba Team Member (since 2001) https://samba.org Samba Team Lead, Catalyst IT https://catalyst.net.nz/services/samba