LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Western Digital NAS "My Cloud Mirror" runs Linux: how to delete hard-coded "Pubic" share? (https://www.linuxquestions.org/questions/linux-newbie-8/western-digital-nas-my-cloud-mirror-runs-linux-how-to-delete-hard-coded-pubic-share-4175654819/)

Bewildered Penguin 05-29-2019 09:57 PM

Western Digital NAS "My Cloud Mirror" runs Linux: how to delete hard-coded "Pubic" share?
 
Newbie here.

Just wondering where I should post a question I have regarding trying to make some modifications to my NAS, which runs Linux.

https://i.imgur.com/v4dbkuE.jpg

frankbell 05-29-2019 10:05 PM

I would guess the networking forum might be the best place, but I'm just another LQer. The software forum would be another candidate if this concerns the router software. Before you post, you may want to read this, if you have not already done so.

Welcome to LQ.

michaelk 05-29-2019 10:14 PM

Welcome to LinuxQuestions.

A bit of a broad question. What modifications do you want to make to your router?

If your router is a commercial off the shelf unit please post its make and model number. Most devices that run linux of this type use a specialized embedded version which makes modifications to the operating system almost not possible.

Any other type of router running on a PC or embedded device and with a standard or router based distribution would be much easier to modify depending on what you want to accomplish.

Bewildered Penguin 05-29-2019 10:21 PM

Quote:

Originally Posted by michaelk (Post 6000264)
Welcome to LinuxQuestions.

A bit of a broad question. What modifications do you want to make to your router?

If your router is a commercial off the shelf unit please post its make and model number. Most devices that run linux of this type use a specialized embedded version which makes modifications to the operating system almost not possible.

Any other type of router running on a PC or embedded device and with a standard or router based distribution would be much easier to modify depending on what you want to accomplish.

Edit: oops! I meant NAS, not router. My brain wasn't in gear lol.

I want to delete a hard-coded share called "Public" which it is not possible to remove from the GUI.

Manufacturer:
Western Digital

Model:
WDBWVZ0040JWT-20

My Cloud Mirror (4 TB)

https://www.wd.com/content/dam/wdc/w...gw.500.500.jpg

evo2 05-29-2019 10:36 PM

Hi,

think that's not a router but a type of NAS. Anyway instructions for getting a root shell via ssh can be found at
https://support-en.wd.com/app/answer...il/a_id/26497/

Once you have a root shell on the device you should be able to break, sorry modify, whatever you like.

Evo2.

Bewildered Penguin 05-29-2019 11:18 PM

Quote:

Originally Posted by evo2 (Post 6000271)
Hi,

think that's not a router but a type of NAS. Anyway instructions for getting a root shell via ssh can be found at
https://support-en.wd.com/app/answer...il/a_id/26497/

Once you have a root shell on the device you should be able to break, sorry modify, whatever you like.

Evo2.

I meant NAS, not router. My router also runs Linux; I guess I mixed them up.

I've got to that point: SSH'd in via PuTTY. Not sure where to go next! I'm a self-confessed Linux noob but prepared to learn whatever is necessary. Do I need to learn Bash scripting? Something else maybe?

Here's what I want to do:

1) Delete the default "Public" share

2) Create a share with a space (spaces are not permitted in share names created using the GUI)

And yes, I really don't want to brick it. Will need to be very careful.

JJJCR 05-29-2019 11:45 PM

Quote:

Originally Posted by Bewildered Pengiun (Post 6000268)
Edit: oops! I meant NAS, not router. My brain wasn't in gear lol.

I want to delete a hard-coded share called "Public" which it is not possible to remove from the GUI.

Manufacturer:
Western Digital

Model:
WDBWVZ0040JWT-20

My Cloud Mirror (4 TB)

https://www.wd.com/content/dam/wdc/w...gw.500.500.jpg

I believe there should be a samba config.

Have you checked it and see whether you can unshare it from Samba config.

Bewildered Penguin 05-30-2019 12:24 AM

Quote:

Originally Posted by JJJCR (Post 6000287)
Have you checked it and see whether you can unshare it from Samba config.

Not yet. I don't really know how to do that, unfortunately.

I'm a Windows user. This is my first time dabbling with Linux, so I'm still a complete noob.

Are there any websites or online resources you can recommend for me to study, specifically related to Samba and any other knowledge that might help me to make adjustments to my NAS—beyond what Western Digital allow in the GUI?

evo2 05-30-2019 12:32 AM

Hi,

you could start at the Samba wiki. https://wiki.samba.org
Samba is likely the service that provides the shared "folders".

Probably worth checking https://community.wd.com too.

Evo2.

P.S. I strongly recommend not using spaces in the names of shares, and it seems Western Digital feels even more strongly about this than I do.

Bewildered Penguin 05-30-2019 12:49 AM

Really appreciate the recommendations. Looking forward to reading through them.

Quote:

Originally Posted by evo2 (Post 6000294)
P.S. I strongly recommend not using spaces in the names of shares, and it seems Western Digital feels even more strongly about this than I do.

Western Digital lock down all sorts of things, so I don't mind too much about what they feel strongly about! They also seem to feel quite strongly that users should not be allowed to disable/rename the "Public" share, which is ridiculous. Not everything they lock down is because of best practice, some of it is quite arbitrary and didactic, "Use our product the way we want you to!"

Can you give me some possible reasons why a space in a share wouldn't be advisable with Samba? I've been using SMB shares on Windows for years, with occasional spaces and never had any issues. I found they can improve readability for users who are looking through their list of mapped drives, and everything works the same, other than I had to put UNC file paths in quotation marks when scripting with batch files if there was a space in a share name!

evo2 05-30-2019 01:46 AM

Hi,
Quote:

Originally Posted by Bewildered Pengiun (Post 6000303)
Can you give me some possible reasons why a space in a share wouldn't be advisable with Samba?

Maybe not a big deal for mouse jockeys, but dealing with filenames and shares with spaces in them can be a total pita for people on the commandline. However, I doubt that is the WDs reason.
Quote:

Originally Posted by Bewildered Pengiun (Post 6000303)
I've been using SMB shares on Windows for years, with occasional spaces and never had any issues. I found they can improve readability for users who are looking through their list of mapped drives, and everything works the same, other than I had to put UNC file paths in quotation marks when scripting with batch files if there was a space in a share name!

If you want to ease readability you have a number of options. For example if you wanted "Our family films", you could instead use

Underscores: Our_family_films
Hyphens: Our-family-films
Camel case: OurFamilyFilms

Evo2.

Bewildered Penguin 05-30-2019 08:58 AM

Quote:

Originally Posted by evo2 (Post 6000318)
If you want to ease readability you have a number of options. For example if you wanted "Our family films", you could instead use

Underscores: Our_family_films
Hyphens: Our-family-films
Camel case: OurFamilyFilms

Evo2.

Makes sense.

I have actually worked with file paths which contained spaces in the command line on Windows a fair bit and I found the same rule applies as with scripts: just remember to throw quotes around every reference to "Our Family Films" and everything works beautifully. But yeah, I have heard a lot of IT guys say what you say about hating spaces; I can see how it could be considered a PITA.

So anyway, I've already checked out the WD Community forums and boards. There are a lot of users frustrated with having a default share that they can only change permissions on and neither rename nor delete.

I saw this discussion already:
https://community.wd.com/t/delete-or...-folder/195048

A user asked:

" I would love to get rid of the term “public” on MyCloud because it just plain makes me nervous. Is there a way to change the name of this folder? or Do I need to make a new folder, move everything over to it and then can I delete it or hide it?"

The response:

"The Public folder cannot be deleted or modified. You would have to relocate the files out of the Public share and set it to private with no access. It will still be seen on the network, but it will not be accessible."

Ugh!

This thread was a bit more promising and actually had some commands:
https://community.wd.com/t/removing-...mycloud/137086

------------------------------------------------------

Guide and scripts to remove or restore the public share on WD My Cloud:

#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

------------------------------------------------------

Unfortunately, the combination of my lack of Samba knowledge, and the fact that the above commands are possibly for a different firmware revision of my NAS, mean I'm still scratching my head on this one.

I actually tried running the above commands but got an error message.

Assuming the above commands were for a different firmware version, any ideas how I could analyze my NAS to find out what's going on and write my own commands to remove the share?

I really don't mind if this takes me all week to figure out, as long as I: a) learn from it and b) don't brick it!

michaelk 05-30-2019 09:30 AM

Anything outside of the /etc/samba/smb.conf I would consider specific to the operating system and how it initializes samba shares and not similar to a typical desktop samba installation. This makes specific help difficult unless other members also have a WD NAS.

You did not specify where the above commands failed and if the process has changed from versions then it might be a matter of just searching through directories to see if you can find similar scripts.

Bewildered Penguin 05-30-2019 10:20 AM

Quote:

Originally Posted by michaelk (Post 6000435)
You did not specify where the above commands failed and if the process has changed from versions then it might be a matter of just searching through directories to see if you can find similar scripts.

I think that's what I need to do: look through all the directories and read all the code to see what's going on.

This is all I've got so far. Was expecting to see more files in the root directory:

root@NAS root # ls-al
drwxr-xr-x 2 root root 1024 May 30 09:15 .
drwxr-xr-x 4 root root 1024 May 14 20:27 ..
-rw------- 1 root root 205 May 30 09:37 .ash_history


Time for me to learn Bash.

michaelk 05-30-2019 10:34 AM

Because there are not any files in the root directory. /root is the home directory for the root user and not the top of the directory tree i.e /.
try:
cd /

There are many linux basic guides.


All times are GMT -5. The time now is 11:23 PM.