Unable to set access rights to shares
If you are unable to set or change permissions to your shares (via Access Right Management > Share Folders) that could mean, your smb.conf
file become corrupted.
Here are some tips and tricks on what to do in that case.
First step
Before you approach any other step or tip here, first make sure that your device is not installing any firmware update. QNAP devices are known to disable Samba shares (and make a lot of other strange things) during firmware update.
If you’re device is up-to-date or is not updating right now, then simply restart it. I’ve approached at least three situations, where all shares were gone and were magically restored after simple restart.
Only then, when above fail or bring no results, continue with this article.
Samba config file corruption
If you connect to your QNAP with SSH (PuTTY seems to be a good choice, remember that you need to login as admin!), try to locate your Samba configuration file. On QNAP TS-210 it is /etc/smb.conf
, which turns out to be symbolic link to /etc/config/smb.conf
or /mnt/HDA_ROOT/.config/smb.conf
. If you can’t locate it, try to use find -name smb.conf
.
Now, all goes depending on whether your config file is just a little bit corrupted or you have a really big fuckup.
First of all, check, if your smb.conf
file does not contains map hidden = no
as the first line or in any line above first group (usually [global]
). If yes, then you’re lucky and 90% chances your troubles are going to be solved easy.
Just move this line below [global]
line to include this configuration switch as a part of general configuration. Most likely, it got there as a result of an error and it is confusing Samba parser causing effects you may observe (no way to set or change permissions).
Once done that, restart Samba (/etc/init.d/smb.sh restart
) or — the better thing — all services (“/etc/init.d/services.sh restart`). Then try to change some permissions and see, if that brings any effect.
If not, or if you can’t find, that map hidden = no
is in incorrect position in your smb.conf
file, then you’re less lucky than you would expect.
Yeap! As far as I know, there is no other way in this scenario.
The easiest way is to rename your Samba config file (mv smb.conf smb.conf_old
) and replace it with your backup copy, assuming you have one. You probably don’t have, right…
Try to create an empty file in its place (touch smb.conf
) and then make use of an option Access Right Management > Share Folders > Restore Default Network Shares
to recreate new smb.conf
in place of corrupted one. This might fail.
If it will succeed, you may trie hard and probably pointles work of taking old (corrupted) and new (restored) Samba configuration file and manually copy your private shares (entire groups named by []
chars) from corrupted one to clean one. Then copy manually edited file over smb.conf
, restart device and look, if you’re at least a little bit lucky.
If this operation fails or brings no results or manual restore of all shares is not an option for you, you can consider editing or fixing smb.conf
manually. But this require a larger knowledge of both Linux, Samba and smb.conf
file format. Some, very basic, knowledge can be found here or anywhere else in the Internet.
Even, if you manage to edit and change your share’s permissions manually, by editing smb.conf
file, you probably won’t be able to make it back not corrupted — i.e. you still won’t be able to change permissions via Control Panel and will always have to apply them manually.
If you don’t want to go above mentioned way (delete smb.conf
file and restore all shares from scratch, you may try to extract this file from a backup copy, which is available in newer versions of QNAP’s firmware. This is even harder way, but it was described very well here, by schumaku.
No matter, what you do to your smb.conf
file, remember to restart the service (/etc/init.d/services.sh restart
) or the whole NAS, so your changes will take an immediate effect.
Restoring entire device back to factory defaults is also rummored as solve to this problem (not checked by me), if this is an option in your case (not in mine).
Final words
If you’re editing your QNAP’s files under Windows, make sure, that you use a text editor, that supports Linux line ending (LF
— Line Feed
). If you use Windows Notepad or any other text editor, which doesn’t support this, your fill will be written with CR+LF
(Carriage Return + Line Feed
) line endings, used on Windows, making it (and whole Samba service) completely unusable!