Documentation for using ssh

Is there some documentiation out there for using ssh?

@lastebill Have you looked at this which is found in the Knowledge Base.

This may help too.

1 Like

SSH is merely a means of logging into a system (in this case the linux OS powering the MyCloud).

Thereafter, you need an appropriate linux tutorial (either debian for gen1, or Busybox for gen2).

And, of course, mucking about via SSH is not 'formally supported by WD. Yes, I know they offer SSH access, which suggests they’re sort of encouraging users to use SSH to access their devices


1 Like

Just a reminder for those looking to use SSH


Per WD:
Critical: The use of SSH (Secure Shell) can potentially harm the My Cloud device and could result in loss of access to the device and/or data. The use of SSH to modify or attempt to modify the device outside of the normal operation of the product voids your WD warranty

Bottom line is this, if you don’t know what you are doing you can very easily brick (render unusable) one’s My Cloud by issuing the wrong command when one uses SSH to access their My Cloud. For example DO NOT perform an “apt-get”. Period!!! Doing so will likely cause problems or outright brick your stock firmware My Cloud.

1 Like

Have you noticed that nobody ever says here is how you can use SSH to get things done in this device? All they ever do is point you to topic 8 and say this is how you activate it. OKAY! It’s activated!

HOW CAN I USE SSH TO GET THINGS DONE?
I can log in with SSH.
One thing I noticed is it can give me a list of commands available, but there is absolutely no help for actually using those commands.
Hell, LS won’t even work to get me a file listing.

My GUI is not responding to allow a login.

Well is is ls not LS. Linux is case sensitive. You can also google any Linux command. There are hundreds of Linux commands. Some commands will work on the Gen1 but don’t exist on the gen2. Some commands that you could use are.
cd ls du df cat more
cd / gets you to the root of the filesystem. cd 
 takes you back one level. cd /var/log takes you to the location of most log files.
ls list files by name. ls -l list files with information about permissions dates size. ls -al will also list file that start with a period.
du gives you the amount of disk used by each directory. du -h lists the size in human readable form. du -hd 1
will list the amount of disk used by each directory in the current directory not recursive.
df will list information about each mounted disk. df -h will list that information in human readable form.
cat will display a file to the console. cat |more will list the contents of a file one page at a time. JUst hit the space bar or the return key to step one line or one page at a time.
Note if you cat an executable file the screen may go nuts.
Does this help?

1 Like

Well it would be helpful is you specified exactly what you want to do with SSH on the device. SSH is not officially supported by WD which is why they haven’t put together a comprehensive (or even basic) guide on how to use it with the My Cloud. Instead they leave it up to the end user/customer to be knowledgeable and figure things out on their own.

The main problem with SSH is one can easily render their My Cloud unusable (like performing an apt-get). So rather than get yelled at by people when one provides specific directions and someone with zero SSH/Linux experience screws up, one will get the generic “use google to find out how to use SSH” from more than a few users here ,including myself.

Here’s a suggestion. Since you are not happy that nobody here ever says how you can use SSH to get things done on this device. Why don’t you sit down and take the time to put together a set of directions on how to use SSH to accomplish everything this device is capable of (both versions mind you). Then share it with the rest of the good folks here. (just a thought :wink:)

Edit to add: As previously pointed out the SSH directions for the first gen may not be the same as the second gen. Further, to complicate things even more. While one set of SSH steps (like for unbricking) may work for me, they may not work for someone else. Found that out when trying to unbrick a first gen My Cloud using a number of different suggestions here. What worked for one person didn’t work for me even though we have the same My Cloud version/generation.

SSH is a power tool. It is meant for people that know what they are doing. There are a number of ways to learn how to use it, and use it effectively/properly, but gaining that skill or insight is not really the motivation behind most of the postings that involve using SSH to “get something done.”

Much like any other power tool, using it without knowing what you are doing can cause a great deal of mayhem. This is the reason why WD gives that nasty disclaimer when you turn it on, and why many people here are loathe to suggest it as “the accepted answer” to some of the more common types of problem here.

For some kinds of problem, there really is no other way. (Such as fixing borked up permissions caused by the wdsync utility.) For others, there could be web-gui based solutions that should be presented first for the safety of end users.

If you want to learn how to use SSH, I would suggest getting a linux live image, and loading it up in a free virtual machine (like virtualbox, vmware, bochs, and pals), and learning about the linux console using the many online resources and linux community forums that live out there. It’s a valuable job skill in today’s world— both obtaining that information on your own (and learning how and where to look to find it), as well as being a fluent user of the linux console.

SSH is just a remote method of accessing said console.

IF you choose to do something with ssh, be sure to follow a guide to the letter. I bricked mine and unbricking it is not easy. I managed to get it to perform better, but then I did an apt upgrade
 not smart

Yes. This cannot be stressed enough with the single bay My Cloud models


DO NOT issue the apt-get command on these devices because they typically use a custom version of Linux and an apt-get will often brick the unit as many have found out. Especially do not issue the apt-get command on a first gen v4.x single bay My Cloud due to the different page file size the firmware uses.

While I completely agree with all warnings above, here’s a few tips for power users (on a unix OS).

  • Use a static IP on your NAS. Don’t lose time searching for its IP address.
    If you need to look up the IP address anyway and are too lazy to login to your router, just scan your network for a Western Digital network interface.
sudo nmap -sn 192.168.0.0/24  | grep Western -B2
Nmap scan report for mycloudnas (192.168.0.101)
Host is up (-0.10s latency).
MAC Address: 00:14:EE:02:BD:FF (Western Digital Technologies)
  • Add your NAS to your ssh config, usually located at ~/.ssh/config. Add a section like this
Host wdnas
    Hostname 192.168.0.101         # or use the name of your nas
    User root                      # no need to type the user all the time
    HostKeyAlgorithms +ssh-dss     # only use this if required
  • Now you can login with this short command
ssh wdnas
  • You can also copy files from and to your NAS
scp wdnas:/var/log/mycloud.log ~/Documents
scp -r ~/Documents/somedir  wdnas:/shares/SomeShare
  • Passwords are lame. Use login by public key instead. You never have to type your password no more.
    If you did update your ssh config, installation of your public key is as simple as this.
ssh-copy-id wdnas
  • To keep your authorized keys after reboot, use a persistent home directory, e.g. by installing Entware from www.wdcommunity.com


Enjoy!

2 Likes

I prefer reserved IP addresses using the router dhcp reservations. Do you know what my Cloud these applications are written for? Gen1 or Gen2. Could cause problems if installed on the wrong gen.

I only make packages for 2nd gen devices (anything on firmware v2.x). The binaries won’t even install on other devices afaik.

I have just put a new USB drive into my PR2100, and I am using SSH to copy the movies and music I have to the USB.

I did start this in windows, via wifi, but you are causing the files to be passed to the pc and then back to the USB on the PR2100, which was taking forever.

So instead I just SSH on and change directory to the movies folder and then do a “cp -Rv * /shares/USBBackups/Movies”

This does a copy from the current folder and recursive folders, verbosely so you can see what is happening, to the New USB drive. This time the data is moving directly from the PR2100 to the USB, so its much quicker than using wifi.

It would be nice if the SSH supported “screen” so could detach from the SSH and leave it running. Has anybody added Screen to the PR2100 OS for this purpose?

1 Like

“screen” or “tmux” (which accomplishes the same thing) would run on the client that you use to ssh into your PR2100, not on the PR2100 itself. screen is normally installed on any linux and Mac client
I don’t if Windows has something similar.

[screen] is not natively baked into the mycloud’s firmware, sadly. Fox_exe’s wdcrack (WARNING: Voids warranty) enables installation of a debian chroot, however, which will give you every linux command you can ask for, including apt repository access. (His chroot package automatically mounts the normal share tree inside the chroot, so you can manage the filesystem there easily.)

Alternatively, something like my ‘hijack’ of wdcrack’s late-stage user init script (which I use to enable iscsi support on the single bay gen2 units) could be used to on-the-fly produce symlinks in the ram-disk filesystem pointing to binaries in a permanent location, and use that with statically compiled [screen]. That would give you stateful ssh sessions, but would very much void your warranty.

1 Like

I think you missed my point
the MyCloud is the server; a pc or mac is the client. You connect from the client to the server using ssh. screen or tmux only have to run on the client, not the mycloud.

Just to add my twopenneth into this discussion.
The WD MyCloud First Gen (I’m not sure about second gen which I believe uses BusyBox), is actually a miniature Linux Server preset to deliver a dashboard to allow the user to create users, shares and manage various aspects of the cloud file sharing functions for which it is pre-configured, but at it’s heart (if you know what you are doing with it), is quite a powerful server.

SSH (Secure Shell), allows you to open a remote Terminal or Command Line and issue commands to the Linux Bash Shell on the server for your PC/Mac/Linux/Android device. I’ve used puTTY, but my preference is for Termius which is also free (ignore the premium functions) and I find a bit cleaner.

My configuration is to have the DHCP on my Router assign a static IP address to the WD MyCloud drive so I always know what it is on my internal network, and I have a free account with NO-IP which is also configured onto my router so that it informs NO-IP whenever my router changes it’s external IP address, that way my tablet and laptop connect via the NO-IP supplied domain name rather than an IP address, and I don’t have to worry about my external IP address keep changing.

I found that the SafePoints are dreadfully slow, so I designed an alternative solution using a python script which can send emails. This is summoned from a bash shell script which uses rsync to backup each of the shares (one a night starting on the 1st of each month - it’s enough for me). The process sends me an initial email to say it is starting the backup, followed by a second once the backup has completed with a list of all the files which have been copied, updated and deleted.

I also have a script which checks my external facing IP address on the router and logs whenever this changes and again, sends me an email. It was initially designed before I discovered how to configure the router with NO-IP as I needed to be aware of IP address changes when away from home, later it was used to prove to my ISP that the routers they were supplying were faulty and resetting a lot, sometimes several times an hour, and when you are trying to play an MMORPG was becoming a nightmare, now I keep it as a reference.

I use SSH to copy files from the cloud to removable drives (having attached a 4 port powered USB3 hub to the drive, and the backup drive to the hub as this is a LOT quicker than pulling them from the drive via a PC to the USB.

I also have scripts which clear out spotlight and junk files that my Mac is so fond of creating, and scripts that test each of my websites to ensure they are all on line (I host externally not from my own servers).

I have installed software onto the cloud drive, at present I can run Midnight Commander if I need to, and updated rsync to the latest version as the one that ships with the WD MyCloud is somewhat flakey at times when it comes to large volumes of files. But as everyone else has pointed out - be extremely careful doing this as it is possible to completely brick the drive, which I have done and it took me some time to recover it and get it running again.

1 Like

can anyone here add step by step instructions on how to issue shutdown command opening putty for the first time using windows 10

device: WD mycloud EX2 ultra

Note that the commands used to shutdown the single bay My Cloud units (both first gen and second gen) may not be the same as those used on the multi bay My Cloud units. This subforum, My Cloud, generally discusses the single bay/single drive My Cloud units, so various commands suggested here may or may not be appropriate for the EX2 Ultra.

One, if they haven’t done so already, may want to see the dedicated My Cloud EX2 subforum where the EX2 Ultra units are discussed. Assuming one is using OS3 - v2.x firmware and not the newer OS5 - v5.x firmware. There are a couple of discussions about using SSH to issue the shutdown command in that EX2 subforum.

https://community.wd.com/search?q=shutdown.sh%20category%3A109

Some discussion on using the shutdown.sh command via SSH on the EX2 devices.

Additional discussions on using the shutdown.sh command in some other posts and subforums that may help.
https://community.wd.com/search?q=shutdown.sh