[HOWTO] Get rid of Public shares folder once and for all

Hey Guys,

many users try to get rid of the Public shares folder or at least restrict access with more or less success. Some working solutions do not survive a reboot. That’s why I grepped my way through the MyCloud scripts and found a satisfactory way (for me) to do exactly that.

You will need root access for your MyCloud so please be aware you may break somethning! Do this at your own risk!

/etc/wdcomp.d/boot//bootscript_005_wd-nas

Comment out the following lines:

 ----

#uniqShareName=“$(createUniqueShare “Public” “Public” “any”)”
#result=$?
#if [$result -eq 0]; then

logger -s -p local2.debug "$0: DEBUG: createUniqueShare ${uniqShareName} returned$

#else

logger -s -p local2.err "$0: ERROR: createUniqueShare ${uniqShareName} returned $$

#fi


This will prevent your mycloud from (re)creating the Public folder.

/usr/local/sbin/createDataVolume.sh

comment out these lines


mkdir -p “/DataVolume/shares/Public/Shared Music”

mkdir -p “/DataVolume/shares/Public/Shared Videos”

mkdir -p “/DataVolume/shares/Public/Shared Pictures”


— 

#chown -R root:share /DataVolume/shares/Public


Will prevent your mycloud to lay out the filesystem for the public share.

/usr/local/sbin/deleteShare.sh

comment out these lines


#lowerCaseShare=echo $shareName | tr '[:upper:]' '[:lower:]'
#if [$lowerCaseShare == “public”]; then

echo “Cannot delete Public share”

exit 1

#fi


Will make it possible to use WDs own script to delete the public share. I like this solution because it does everything that is needed to remove a share not just delete the folder structure or remove samba config etc…

execute this command:

---- 

/usr/local/sbin/deleteShare.sh Public


Will finally remove the Public share and associated infos on the device.

After following these steps the Public share folder should be permanently removed and not revive reboots.

Yours sincerely,

schnip

2 Likes

That does look a clean way of doing things; subverting WD’s scripts to remove the automatic folder creation and the deletion veto, which are special cases.

You’ll probably have to re-do the changes on a firmware upgrade.

Having removed the ‘Shared’ folders during my Twonky investigations, and telling Twonky to use other shared folders for its aggregation, I don’t have a problem with the MyCloud recreating the ‘Shared’ folders, even when it reboots. So I’m not sure whether createDataVolume.sh is run every reboot; maybe only on Factory Restore.