need help making a change in smb.conf "stick" after reboot

Introduce yourself to us and other members here, or share your own product reviews, suggestions, and tips and tricks of using QNAP products.
Post Reply
Bob Zelin
Experience counts
Posts: 1084
Joined: Mon Nov 21, 2016 12:55 am
Location: Orlando, FL.
Contact:

need help making a change in smb.conf "stick" after reboot

Post by Bob Zelin » Wed Jun 09, 2021 8:19 am

Hi -
I need to make a change in the QNAP /etc/smb.conf file that is very minor. The change works, and makes my program work when I make the change, but if I reboot the QNAP, it reverts back to the original smb.conf file.

Does anyone know how I can do this ?

Thanks -
Bob Zelin
Bob Zelin / Rescue 1, Inc.
http://www.bobzelin.com

User avatar
dolbyman
Guru
Posts: 23581
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: need help making a change in smb.conf "stick" after reboot

Post by dolbyman » Wed Jun 09, 2021 8:41 am

you can add a script to autostart.sh and make the changes on every reboot

e.g.
viewtopic.php?t=155172

Bob Zelin
Experience counts
Posts: 1084
Joined: Mon Nov 21, 2016 12:55 am
Location: Orlando, FL.
Contact:

Re: need help making a change in smb.conf "stick" after reboot

Post by Bob Zelin » Thu Jun 10, 2021 6:59 am

Hi dolbyman -
from your link, OneCD writes -
Note: this change is not persistent and will need to be performed after each QTS startup. Use something like [autorun.sh] to make this change programatically:

Now I have to figure out how to do autorun.sh !
Thanks -
Bob
Bob Zelin / Rescue 1, Inc.
http://www.bobzelin.com

User avatar
dolbyman
Guru
Posts: 23581
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: need help making a change in smb.conf "stick" after reboot

Post by dolbyman » Thu Jun 10, 2021 7:13 am

directly below is an example of what you can put in the autorun (for the specific linked case) :)

autorun can be enabled in

ControlPanel>Hardware>General>Run user defined processes during startup

@OneCD can probably help too if you let us know what exactly you want to add to the SMB.conf

Bob Zelin
Experience counts
Posts: 1084
Joined: Mon Nov 21, 2016 12:55 am
Location: Orlando, FL.
Contact:

Re: need help making a change in smb.conf "stick" after reboot

Post by Bob Zelin » Sat Jun 12, 2021 4:33 am

I simply want to remove part of one line of code in the smb.conf file.
So I
vi smb.conf
make the deletion
:wq!
And now it works. So now, I want to have this auto run, and not change back to the previous original version when I reboot the QNAP

Bob
Bob Zelin / Rescue 1, Inc.
http://www.bobzelin.com

User avatar
OneCD
Ask me anything
Posts: 9182
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: need help making a change in smb.conf "stick" after reboot

Post by OneCD » Sat Jun 12, 2021 4:37 am

Bob Zelin wrote:
Sat Jun 12, 2021 4:33 am
I simply want to remove part of one line of code in the smb.conf file.
To make the change programatically, you'll need to post the content of the entire line you're changing. Before-and-after examples would be great. It's then possible to construct a command to make this change. ;)

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage

Bob Zelin
Experience counts
Posts: 1084
Joined: Mon Nov 21, 2016 12:55 am
Location: Orlando, FL.
Contact:

Re: need help making a change in smb.conf "stick" after reboot

Post by Bob Zelin » Sat Jun 12, 2021 5:12 am

this is in QuTS (not in QTS - they are different) -
in /etc/smb.conf
under [global]

this is the current line of the latest firmware build h4.5.3.1670

vfs objects = shadow_copy2 richacl catia fruit qnap_macea streams_depot aio_pthread

I want it to read
vfs objects = shadow_copy2 catia fruit qnap_macea streams_depot aio_pthread

so I am removing "richacl" -
the way I am describing it, is exactly how it reads in regular QTS for 4.5.3.1670

My application problem is "fixed" when I remove "richacl", but upon reboot, the original line comes back, and then my application no longer works.

So how do I get this to stick ?

Thank you OneCD for looking at this.
Bob Zelin
Bob Zelin / Rescue 1, Inc.
http://www.bobzelin.com

User avatar
OneCD
Ask me anything
Posts: 9182
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: need help making a change in smb.conf "stick" after reboot

Post by OneCD » Sat Jun 12, 2021 5:36 am

Bob Zelin wrote:
Sat Jun 12, 2021 5:12 am
So how do I get this to stick ?
No worries, this is an easy one. :geek:

Let's use a basic regex to search for the string "shadow_copy2 richacl catia" and replace it with "shadow_copy2 catia":

Code: Select all

/bin/sed -i 's|shadow_copy2 richacl catia|shadow_copy2 catia|' /etc/smb.conf
Then restart the Samba service.

If the change is reverted after restarting Samba, then we'll need to edit the Samba service script instead.

The change will always be reverted after restarting the NAS. So, add the above line (and service restart command) to your autorun system.

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage

Bob Zelin
Experience counts
Posts: 1084
Joined: Mon Nov 21, 2016 12:55 am
Location: Orlando, FL.
Contact:

Re: need help making a change in smb.conf "stick" after reboot

Post by Bob Zelin » Sat Jun 12, 2021 5:52 am

ok - perhaps this is what I am not understanding -
I do not have an auto run service setup like autorun.sh

Do I need to do this, and then add that line - (this is my first time doing this) -

All HAL-based Intel and AMD NAS:

Starting from QTS 4.3.3 it's required to enable the autorun.sh processing in the Control Panel -> Hardware -> General: Run user defined startup processes (autorun.sh)

mount $(/sbin/hal_app --get_boot_pd port_id=0)6 /tmp/config

Create/Edit /tmp/config/autorun.sh.

either using vi:
# vi /tmp/config/autorun.sh


Get vi editor into edit mode: press a
Edit whatever you need to
Exit edit mode: press ESC
Save and exit: x
or editing it using a desktop PC and e.g. SFTP
Ensure that /tmp/config/autorun.sh is executable
# chmod +x /tmp/config/autorun.sh


IMPORTANT: Unmount the mounted flash partition:
# umount /tmp/config
Bob Zelin / Rescue 1, Inc.
http://www.bobzelin.com

User avatar
OneCD
Ask me anything
Posts: 9182
Joined: Sun Aug 21, 2016 10:48 am
Location: "... there, behind that sofa!"

Re: need help making a change in smb.conf "stick" after reboot

Post by OneCD » Sat Jun 12, 2021 5:56 am

Might be better to use the create-autorun script here: viewtopic.php?f=45&t=130345

ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage

User avatar
dolbyman
Guru
Posts: 23581
Joined: Sat Feb 12, 2011 2:11 am
Location: Vancouver BC , Canada

Re: need help making a change in smb.conf "stick" after reboot

Post by dolbyman » Sat Jun 12, 2021 6:00 am

yes you already posted all steps

1. mount the /tmp/config (command given)
2. edit the file with vi (command given)
3. paste OneCD's command in there
4. save the file (hit escape and type :wq)
5. make executable (command given)
6. unmount the /tmp/config location (command given)

and then you are done (you can check the autorun via the GUI where you enable it on startup)

*edit* or do as OneCD hints :P

Bob Zelin
Experience counts
Posts: 1084
Joined: Mon Nov 21, 2016 12:55 am
Location: Orlando, FL.
Contact:

Re: need help making a change in smb.conf "stick" after reboot

Post by Bob Zelin » Sat Jun 12, 2021 10:31 pm

thank you - I will try this !
Bob
Bob Zelin / Rescue 1, Inc.
http://www.bobzelin.com

Post Reply

Return to “Users' Corner”