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 |
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. |
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. |
Quote:
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 |
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. |
Quote:
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. |
Quote:
Have you checked it and see whether you can unshare it from Samba config. |
Quote:
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? |
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. |
Really appreciate the recommendations. Looking forward to reading through them.
Quote:
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! |
Hi,
Quote:
Quote:
Underscores: Our_family_films Hyphens: Our-family-films Camel case: OurFamilyFilms Evo2. |
Quote:
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! |
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. |
Quote:
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. |
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. |