Hello there, I’m new to the forum so I hope I’m not making any mistake of any kind.
The title of the post explains what I need to do, enable SSH access for every user (I need SSH only to make users able to use SFTP instead of FTP, this is because I need my NAS to be accessible from outside my local network, and FTP is not really the best option, and I’m pretty sure that even SMB is not a good idea).
From the settings of the NAS dashboard, I am able to enable SSH, but only for the root user. Then what’s the problem, go to /etc/ssh/sshd_config and add other users… well there are 2 problems with this. First of all I can’t find a way to restart the ssh server and make the new configs work. Second, and most important, every time I reboot the system (so that the changes in the configs could starts working) the sshd_config file is back to it’s default configuration.
This makes it impossible for me to enable users to have ssh access. I’ve searched on google and different forums to see if there was any option, but didn’t have any luck.
Also checked to see if there was any application on the store, but nothing. And since the NAS uses BusyBox I’m extremely limited in what I can and can’t do, I know I can install applets for BusyBox (somehow) but I’m would just like to add another user.
I suppose there is somewhere, even if I could not find it yet, a file storing the default configurations, where is this file? I’ve tried to use the find command to see where it was saved, but nothing.
Thank’s for any help and sorry if I have made any grammatical mistake (English is not my main language).
Note: I know that WD provides apps and web interfaces for accessing the NAS, but honestly, they both look awful, the web app require flash player for doing anything (upload and download, and even having flash player I have problems with it) while the app is old and does not seem to work.
Plus, I use Transmit for SFTP which gives me a ton of functions, so… I need answer only SFTP related, thank’s!
Thank’s for the reply.
I did edit the /etc/ssh/sshd_config and the result is that it get’s back to it’s default settings on every reboot of the system.
I’l try again just to make sure.
On reboot, all changes to the OS are gone.
You should copy your custom config on boot.
e.g. by adding this into an init.sh script of any app in /shares/Volume_1/Nas_Prog
What you need is something like wdcrack for the gen2 single bay myclouds. It’s basically a user init that pokes some values to make the gen2 think it is an EX2 ultra, but it can be persistently edited after being installed. (Or you could hijack any other enable-able application’s init file just as well…)
Then you could add some entries to make symlinks that point those file handles at persistent storage, and store your modified versions there. It’s how I enabled the iscsi feature on my gen2.
To make the ssh server in my WDMyCloudEX2Ultra work more normally with non-root users, I used the following to restore the configuration files destroyed by the reboot process. The key is to execute a process at the opportune point in the startup, which is done for some of the apps which are installed. By default, there are no apps installed, so I installed the app ‘Camera Backups’, which has the requisite ‘init.sh’ program which can be modified. The app’s init.sh file is /shares/Volume_1/Nas_Prog/CameraBackups/init.sh, and the following lines were added at the end of that file:
# tweaks needed to configure the WDMyCloudEX2Ultra upon reboot
/shares/Volume_1/Nas_Prog/mytweaks/init.sh
The /shares/Volume_1/Nas_Prog/mytweaks/ directory was created and the file ‘init.sh’ was created within:
#!/bin/sh
# tweaks needed to configure the WDMyCloudEX2Ultra upon reboot
# restores items destroyed by rebooting
#
# sshd_config
sed -iBAK -r 's/(AllowUsers .*)/\1 moe larry curly/' /etc/ssh/sshd_config
rm -f /etc/ssh/sshd_configBAK
echo "StrictModes no" >>/etc/ssh/sshd_config
kill -HUP `cat /var/run/sshd.pid` # restarts sshd
To make the file executable, use the command: # chmod +x init.sh