Thursday, January 29, 2015

Adding a non-root users to access SSH in WD My Book Live

Regular (non-root) user's SSH password

URL: http://community.wd.com/t5/My-Book-Live/what-s-my-normal-non-root-user-s-SSH-password/td-p/566360 

Not Not simple, but not too complicated as well. Be careful. Something wrong and you might get locked out.

If I remember all my steps, this is what I did. Make sure you save backups copies for the files before you edit them.

- Enable ssh:
http:///UI/ssh

- Create shares, users, set passwords and permissions via dashboard

- Allow Users to SSH:
edit file /etc/ssh/sshd_config
Change "AllowUsers" line by adding user names such as:
AllowUsers root user1 user2

- Optional: Set users home dir: edit file /etc/passwd
The following will set home dir to "Public"
Change from "/shares:/bin/sh" to "/shares/Public:/bin/sh"

- Restart ssh deamon or reboot:
/etc/init.d/ssh restart

Test ssh for your users within the home network. If all works, then proceed to:
- Set your router to forward port TCP 22
- Set DDNS on your router

===========
Using Cygwin
malex@laptop /home/malex/manuals
$ pwd
/home/malex/manuals

malex@laptop /home/malex/manuals

$ ./rsyncEbookPush.sh

#!/bin/bash

rUser="malex@192.168.10.250"

rsync --remove-source-files -avzhe "ssh -q"  --exclude "rsyncEbook*.sh"  --progress /home/malex/manuals/ "$rUser":/shares/Public/Manuals


$ ./rsyncEbookPull.sh

#!/bin/bash

rUser="malex@192.168.10.250"

rsync -avzhe "ssh -q"  --exclude "rsyncEbook*.sh"   --progress "$rUser":/shares/Public/Manuals/  /home/malex/manuals