SSH access from Ubuntu to MyCloudEX2Ultra

Hello the community!

I am contacting you because I have an issue while setting a ssh connection between my Ubuntu desktop and my NAS (MyCloudEX2ultra model). My plan is to actually define a ssh connection in order to create an automated incremental backup of my home directory using rsync.

Of course, I am not a Linux power user but I found some guidelines to follow and I created my ssh key. The issue occurs when I want to copy this file on one profile. The access to that profile is set by a password that I write properly but the access is denied.

I am wondering about a potential setting issue but here is a screenshot of the network settings :

I also changed the password of my user profile to be sure that I did not miss it and reboot the entire system but without success.

So if anyone of you has an idea about the issue I am encountering, please let me know :slight_smile:

Thanks for your time.

Hi @AlexNox,

I appreciate that you have performed the troubleshooting steps.

Please contact WD Technical Support for assistance to help you easily:
https://support-en.wd.com/app/utils/login_form

First of all check that the user is enabled in /etc/ssh/sshd_config. OS5 default is to only allow sshd user. I think OS3 uses root.

If you are trying to save a public key in an authorized_keys file to facilitate password-less ssh logins be aware that the file can not be in any directory in /shares or /mnt. Sshd will recognize that these directories are writable by anyone and will refuse to use the authorized_keys file for logins.

A solution I have used is to create a secure directory in / to contain the keys and then add an AuthorizedKeysFile line to sshd_config to tell sshd where to look for the keys.

There is a serious caution: Any error in the sshd_config file will prevent sshd from running and you will not beable to log in using ssh at all. So if you go that route test what you are doing very carefully.

1 Like

Thanks for your reply. In the meantime, I switched to another distro and will give another try but I will take your comment into consideration when trying to link both. Thanks a lot!

How do you keep the sshd_config file from being replaced when the OS5 device is restarted?

I wrote a script to append sshd_config. I then added a command to call it in the start for the internal backups app.

Here are the relevant lines in my script:

SSHCONF=/etc/ssh/sshd_config

ALLOW=‘AllowUsers root’
if grep -q “$ALLOW” $SSHCONF
then
echo AllowUsers already set >> $LOG
ALLOW=“”
else
echo $ALLOW >> $SSHCONF
echo set $ALLOW >> $LOG
fi

AKEYS=‘AuthorizedKeysFile /cust/etc/ssh/%u/authorized_keys’
if grep -q “$AKEYS” $SSHCONF
then
echo AuthorizedKeysFile already set >> $LOG
AKEYS=“”
else
echo $AKEYS >> $SSHCONF
echo set $AKEYS >> $LOG
fi

if [ -n “$ALLOW” -o -n “$AKEYS” ]
then
pkill -HUP -f /usr/sbin/sshd
fi

/cust contains a link to my customization stuff
$LOG is /tmp/custom_setup.log

1 Like