How to secure WD My Passport Pro with SSH key

  • firstly enable ssh access from WD My Cloud GUI and setup your own secure password
  • login to ssh with your password
  • modify permissions on /home/root dir - it is too wide open - chmod 755 /home/root
  • generate new public/private keys ssh-keygen -t ed25519 or use your old keys
  • create authorized_keys file mkdir -p /home/root/.ssh/ && touch /home/root/.ssh/authorized_keys
  • add your public key to this file cat /home/root/.ssh/id_ed25519.pub >> /home/root/.ssh/authorized_keys
  • copy private key from /home/root/.ssh/id_ed25519 to your computer and test connection ssh -v -i id_ed25519 root@192.168.60.1
  • if it works, you should disable PasswordAuthentication no in /etc/ssh/sshd_config - remove "#" infront of "PasswordAuthentication yes" and change "yes" to "no". Command  vi /etc/ssh/sshd_config, press insert, make changes, press ESC, press :w!, press enter - it will write, press :q, press enter - will close vim.
  • now type reboot and wait for device reboot

If you did some mistake and you won`t be able to login via SSH, just go to WD support page, download latest firmware and reflash it via browser UI.

More reading on WD Community Forum