Simpler SSH

For those people using putty to SSH into the My Cloud. There is a program called plink.exe. This file can be downloaded the following site.
Download PuTTY: latest release (0.78)
The line below when run from a powershell window will display a list of all files in “Shared Videos” Note the "" before the space character. This is necessary. In quotes put your password. You could also put your password in the script. But either way your password will display on the command line. Better to enter it as you run it. That way its not saved on disk.

.\plink root abbotandcostello “password” “ls -l /nfs/Public/Shared\ Videos”
If you have the sleep.awk code in the Public directory the following code will list the sleep information.
.\plink root abbotandcostello “password” “sh /nfs/Public/sleeptime.sh”

This code would reboot the My Cloud
.\plink root abbotandcostello “password” “reboot”

This code would shutdown the My Cloud
.\plink root abbotandcostello “password” “shutdown”

save the following three lines as plink.ps1
$server=$args[0]+“@”+$args[1]
write-host $server $args[2] $args[3]
f:\plink.exe -ssh $server -pw $args[2] $args[3] $args[4] $args[5]

1 Like

FYI, from a prior thread post some discussion on using plink to shut down or reboot the my cloud from the Windows command line (CMD)…

Here are the call’s I use both in a batch (.bat) file and in SSH Button on my Android phone. In addition to a call to un-mount a an attached USB drive. Obviously replace the IP address and “sdb1” with the correct values for your setup.

Shutdown and power off:
plink.exe -ssh -l root -pw welc0me 192.168.1.10 /sbin/shutdown -h -P now

Shutdown only:
plink.exe -ssh -l root -pw welc0me 192.168.1.10 /sbin/shutdown -r now

Power off only:
plink.exe -ssh -l root -pw welc0me 192.168.1.10/sbin/poweroff

Reboot:
plink.exe -ssh -l root -pw welc0me 192.168.1.10/sbin/reboot

Un-mount USB drive:
“plink.exe -ssh -l root -pw welc0me 192.168.1.10 umount /media/usb”

Or

“plink.exe -ssh -l root -pw welc0me 192.168.1.10 umount /dev/sdb1”

As indicated in that thread discussion one can create batch files (.bat) to automate the process if they so desire. SSH button can be found at this link.

1 Like

Thanks. Didn’t see that before.

RAC

Here is a quick and dirty sample batch file I created a while back. I think I posted this previously but cannot find the thread. Make sure to adjust the IP Address value to match your My Cloud IP Address. Change the password “welc0me” if needed. And make sure plink is in the same directory as the .BAT file. One can copy this script and paste it into Notepad then save the file with the file extension “.bat”, then run it.

ECHO OFF
CLS
ECHO OFF
title WD My Cloud
:MENU
ECHO.
ECHO ...............................................
ECHO Press 1, 2, 3, or 4 to select your task, or x to EXIT.
ECHO ...............................................
ECHO.
ECHO 1 - Shutdown and power off the WD My Cloud
ECHO 2 - Shutdown and reboot the WD My Cloud
ECHO 3 - Power off the WD My Cloud
ECHO 4 - Reboot the WD My Cloud
ECHO.
ECHO x - EXIT
ECHO.
SET /P M=Type 1, 2, 3, 4 or x then press ENTER: 
IF %M%==1 GOTO SHUTDOWNPOWEROFF
IF %M%==2 GOTO SHUTDOWNREBOOT
IF %M%==3 GOTO POWEROFF
IF %M%==4 GOTO REBOOT
IF %M%==x GOTO EOF
IF %M%==X GOTO EOF
GOTO MENU
:SHUTDOWNPOWEROFF
ECHO.
ECHO.
ECHO Shutting down and powering off the WD My Cloud...
plink.exe -ssh -l root -pw welc0me 192.168.1.10 /sbin/shutdown -h -P now
CLS
GOTO MENU
:SHUTDOWNREBOOT
ECHO.
ECHO.
ECHO Shutting down and rebooting the WD My Cloud...
plink.exe -ssh -l root -pw welc0me 192.168.1.10 /sbin/shutdown -r now
CLS
GOTO MENU
:POWEROFF
ECHO.
ECHO.
ECHO Powering off the WD My Cloud...
plink.exe -ssh -l root -pw welc0me 192.168.1.10 /sbin/poweroff
CLS
GOTO MENU
:REBOOT
ECHO.
ECHO.
ECHO Rebooting the WD My Cloud...
plink.exe -ssh -l root -pw welc0me 192.168.1.10 /sbin/reboot
CLS
GOTO MENU
1 Like

This will be helpful for people on this forum.

Thanks
RAC