SSH folder disappears on reboot

I have a WD 2TB My Cloud running firmware version 2.30.165.

From one of my Linux servers, I have done this:

ssh-copy-id sshd@mypnas

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keys
sshd@mypnas’s password:

Number of key(s) added: 1

Now try logging into the machine, with: “ssh ‘sshd@mypnas’”
and check to make sure that only the key(s) you wanted were added.

ssh sshd@mypnas

BusyBox v1.20.2 (2015-02-25 14:32:43 CST) built-in shell (ash)
Enter ‘help’ for a list of built-in commands.

root@mypnas root #

However, when I reboot the NAS and try to connect from the Linux server again using the same ssh command, I’m prompted for the password. I then have to repeat the process above so I can continue to connect to the NAS without a password, till the NAS is rebooted again.

Each time I’m running the ssh-copy-id command, there’s a folder on the NAS being created under /root/.ssh/authorized_keys. After a reboot, the “.ssh” folder is no longer there.

Is this by-design or can something be done to prevent the folder from disappearing on each reboot so I can always login to the NAS without the password?

Root (/) is mounted on ram, so on every reboot it is recreated. To keep your settings save all your files on /dev/sda2 which is mounted on /mnt/HD/HD_a2/ and at reboot copy them where they are needed. This can be done automatically if you install wdcrack from fox_exe.

1 Like

Perfect, it works! Thanks very much!