curl -L https://gist.github.com/codedecay/02e5dc3d487a38d0a89f/raw | sh
#Backup Files
cp /etc/wdcomp.d/boot/bootscript_005_wd-nas /root/bootscript_005_wd-nas.bkup
cp /usr/local/sbin/createDataVolume.sh /root/createDataVolume.bkup
cp /etc/samba/overall_share /root/overall_share.bkup
#Comment out relevant lines in the boot and create script.
sed -i '209,215 s/^/#/' /etc/wdcomp.d/boot/bootscript_005_wd-nas
sed -i '23,25 s/^/#/' /usr/local/sbin/createDataVolume.sh
sed -i '29,29 s/^/#/' /usr/local/sbin/createDataVolume.sh
#Comment out validation in deleteShare.sh if it is present.
sed -i '/echo \$shareName/ {N;N; /delete Public/ s/^/#!!#/}' /usr/local/sbin/deleteShare.sh
sed -i '/#!!#if/,+4 s/^/#/; s/#!!#//' /usr/local/sbin/deleteShare.sh`
#Delete the public share
/usr/local/sbin/deleteShare.sh "Public"
#Comment out the public share definition from the Samba config.
sed -i '1,10 s/^/#/' /etc/samba/overall_share
#Restart the samba service.
service samba restart
##Restore Public Share
curl -L https://gist.github.com/codedecay/02e5dc3d487a38d0a89f/raw | sh
#Either Restore from your backup files..
/bin/cp /root/bootscript_005_wd-nas.bkup /etc/wdcomp.d/boot/bootscript_005_wd-nas
/bin/cp /root/createDataVolume.bkup /usr/local/sbin/createDataVolume.sh
/bin/cp /root/deleteShare.bkup /usr/local/sbin/deleteShare.sh
/bin/cp /root/overall_share.bkup /etc/samba/overall_share
#Or undo the comments in the existing files.
sed -i '209,215 s/^#//' /etc/wdcomp.d/boot/bootscript_005_wd-nas
sed -i '23,25 s/^#//' /usr/local/sbin/createDataVolume.sh
sed -i '29,29 s/^#//' /usr/local/sbin/createDataVolume.sh
sed -i '1,10 s/^#//' /etc/samba/overall_share
sed -i '/#if.*shareName/,+4 s/#//' /usr/local/sbin/deleteShare.sh
#Recreate the Public Share and Directory Structure
mkdir -p "/DataVolume/shares/Public"
mkdir -p "/DataVolume/shares/Public/Shared Music"
mkdir -p "/DataVolume/shares/Public/Shared Videos"
mkdir -p "/DataVolume/shares/Public/Shared Pictures"
chmod -R 775 /DataVolume/shares
chown -R root:share /DataVolume/shares/Public
#Restart the samba service
service samba restart
Ya i suppose line numbers are no good. I’ll update it to either check the file hash before they run or to use unique data to figure out which lines to comment. Since its just commenting out lines not too terribly dangerous.
Somewhere I thought it was indicated that Twonky needs those folders for what ever reason. Why else is WD forcing those folders to be public?
A quick and dirty look at the twonkyserver.ini file shows several entries for the Public folder as a default location where certain files like “uploaded and mirrored” media content are stored.
If one isn’t using Twonky (ie has turned off Media Streaming) then removing those folders may not impact things.
I did this differently. Can’t recall where it is on the forum, but I set the ACL on the Public directory so the owner could read and write to it and everyone else could only read. Because this was done on the Kernel level all I need to do is keep the Public folder empty.
I did this knowing there will be scripts need Public to be there. I played it safe.
[quote=“Myron, post:6, topic:137086, full:true”]
Can’t recall where it is on the forum, but I set the ACL on the Public directory so the owner could read and write to it and everyone else could only read. [/quote]
Your method was posted to this thread: https://community.wd.com/t/be-careful-public-folder-photos/93037/3
For anyone not using the 04.04.00-303 or later firmware the older method using the bug in the Dashboard should still work. This thread explains it: https://community.wd.com/t/controlling-access-to-public-folder/92133
There is a simpler cheat. Se the ACL of a share, so in this case I set the owner user to only the owner/admin user has access to it’s share and then just copy the ACL from that ACL to the Public share.
A quick and dirty look at the twonkyserver.ini file shows several
entries for the Public folder as a default location where certain files
like “uploaded and mirrored” media content are stored.
Yes, but they can be changed. Not from the Dashboard, though…
See:
Q: How can I change the location of the ‘Shared Media’ folders?
Of course the location can be changed, point I was making was that deleting the folders could cause problems if using the Twonky (in certain instances). That’s the problem we face any time we try to fix something under the hood on the My Cloud, fixing one thing may break or cause issues with something else.
It would be nice if WD went on the record (have they?) as to why they are preventing the customer from easily setting the Public folder to private through the Dashboard.