Mounting MyCloud EX2 on a Linux desktop - using Samba

I have been doing the same thing but in reverse direction, that is mounting any CIFS share (i.e. any Windows, Mac or Linux shares) using Samba onto EX2 for almost a year now. I then copy/move files around. I have found this to be the fastest way to copy files to EX2 in some situations (especially data from a QNAP NAS that I also have). In EX2’s case cifs (Samba) is already installed and running, so you don’t have to worry about installing it. The only problem is that you get a “Permission denied” error when issuing a sudo command. But I have found a way to get around it.

To get around the limitation, I have created a script that temporarily allows me sudo access and when I am done, I have another script to reverse my sudo sccess changes because I do not like to retain this sudo access once I am done with whatever I needed sudo for.

So to enable sudo access in SSH, you first make this one time change (until next EX2 reboot - it will be reversed if you reboot EX2 because /etc directory is recreated from scratch):

Type ‘visudo’ to edit the /etc/sudoers file on EX2 using vi. Then edit the line for root under {# User privilege specification" to be:

root ALL=(ALL) NOPASSWD: ALL

After you have made the above one-time change in vi, you are then ready to create the two scripts I talked about above.

Script 1 - enables sudo access (named it grant_sudo.sh):

#!/bin/sh

cp /usr/local/modules/lib/sudoers.so /usr/local/config/

chown root:root /usr/local/config/sudoers.so

rm /lib/sudoers.so

ln -s /usr/local/config/sudoers.so /lib/sudoers.so

Script 2 - disables sudo access (named it revoke_sudo.sh):

#!/bin/sh

rm /lib/sudoers.so

rm /usr/local/config/sudoers.so

ln -s /usr/local/modules/lib/sudoers.so /lib/sudoers.so

To mount any CIFS share (i.e. Windows or Mac shares) on the EX2 you will need to:

  1. Run grant_sudo.sh

  2. Create a mount point with the command ‘mkdir /mnt/cifs’

  3. Mount the CIFS share with the command:
    sudo mount -t cifs //<share server’s IP>/ /mnt/cifs -o username=XXXX,password=YYYY

where username and password are the remote computer’s login credentials

  1. Run revoke_sudo.sh

Now you can move files and folders around between /mnt/cifs and EX2 directories located at /mnt/HD/HD_a2/

If this helps you, please click the star under my username to give me a kudo.