« Back to all recent discussions

How to enable Samba log

Andreas_EAndreas_E Posts: 1  Junior Member
edited July 2018 in Discussions
Hello,

how can i enable the SMB-Log on NAS540/542?
I have tried to edit the smb.conf under /etc/samba/ and add follow lines:
log file = /var/log/samba/%m.log
max log size = 10000
log level = 2 smb:4
With a restart from the NAS the smbd should now log the accesses from the Clients but the changes in smb.conf are undone. 

With friendy Greets from Germany.

#NAS_July
Tagged:

Comments

  • MijzelfMijzelf Posts: 1,073  Heroic Warrior Member
    edited July 2018
    Maybe you can use the Samba tweak in Tweaks
  • VarfalameyVarfalamey Posts: 8  Junior Member
    Up. Nas-Central down.
  • MijzelfMijzelf Posts: 1,073  Heroic Warrior Member
  • Alex MAlex M Posts: 4  Junior Member
    what's the default password for Samba account?
  • BatouBatou Posts: 96  Warrior Member
    Hi Alex M,

    what's the default password for Samba account?
    It depends on which user account you used, the password is the same as that account's setting.
  • VarfalameyVarfalamey Posts: 8  Junior Member
    Mijzelf, is there any syslog-ng tweaks? Cause any reboot sets to default syslog-ng.conf.
  • MijzelfMijzelf Posts: 1,073  Heroic Warrior Member
    No. But if you have a script which does the necessary adjustments, and you have RandomTools installed, you can put that script in
    /i-data/sysvol/.PKG/RandomTools/etc/custom_startscripts/
    to get it executed on boot.

  • VarfalameyVarfalamey Posts: 8  Junior Member
    OK. I'll try. Thank you!

    And there is one problem at NAS542. After rebooting NAS smbd starts without using "smb.conf.Tweaks" config file. Process is "/usr/sbin/smbd -D" for each user.

    I reinstall Tweaks via AppCenter (when installing it lags at 98%; need to press cancel, reboot NAS and install Tweaks again) and enable Samba tweaks. After that smbd starts with a process "/usr/sbin/smbd -D --configfile=/etc/samba/smb.conf.Tweaks".

    Is there any way to solve that problem?

  • VarfalameyVarfalamey Posts: 8  Junior Member
    Looks like after reboot samba.sh from /i-data/sysvlo/.PKG/Tweaks/gui/Tweaks/plugins doesn't exec at startup
  • MijzelfMijzelf Posts: 1,073  Heroic Warrior Member
    The Samba tweak creates the file /etc/samba/smb.conf.Tweaks,  then patches /etc/init.d/samba.sh to add the configfile, and then calls '/etc/init.d/samba.sh restart', as you can read on line 108 of samba.sh. I don't see how that could fail (and it doesn't fail on my box)

    Looks like after reboot samba.sh from /i-data/sysvlo/.PKG/Tweaks/gui/Tweaks/plugins doesn't exec at startup
    Why do you think so? The script is sourced from /i-data/sysvol/.PKG/Tweaks/etc/init.d/Tweaks, starting at line 338. As you can see there is a log function, which can be activated by adding a line

    touch /tmp/${PKG_NAME}.log

    somewhere above 338. Does that give new insights?



  • VarfalameyVarfalamey Posts: 8  Junior Member
    After reboot NAS I was checked /tmp/Tweaks.log. All daemons was started. But adding "touch /tmp/${PKG_NAME}.log" to line 337 gives me 500 error at http://NAS/pkg/Tweaks/pkgcgi.cgi.
    Delete that line and rebbot NAS.
    If I stop samba (/etc/init.d/samba.sh stop), samba continue working. If I restart samba (/etc/init.d/samba.sh restart), samba continue working without --configfile=/etc/samba/smb.conf.Tweaks.
    Any ideas?
  • MijzelfMijzelf Posts: 1,073  Heroic Warrior Member
    If I stop samba (/etc/init.d/samba.sh stop), samba continue working. If I restart samba (/etc/init.d/samba.sh restart), samba continue working without --configfile=/etc/samba/smb.conf.Tweaks.

    Have you checked if samba.sh is patched?

    grep Tweaks /etc/init.d/samba.sh


    gives me 500 error
    That's a syntaxerror in the script. pkgcgi.cgi sources init.d/Tweaks when the webinterface is called. You can check for syntaxerrors with

    sh /i-data/sysvol/.PKG/Tweaks/etc/init.d/Tweaks

    it should run without errors (without any output at all, actually.

    The lines around the adaption should be something like

        chown root:nobody ${TWEAKS_CONFFILE}
        chmod 660 ${TWEAKS_CONFFILE}
        touch /tmp/${PKG_NAME}.log
        Log "Deamon     load plugins"


  • VarfalameyVarfalamey Posts: 8  Junior Member
    Yes, of course. /etc/init.d/samba.sh was patched.
    touch /tmp/${PKG_NAME}.log run with errors.
    Only reinstall get effect.
  • VarfalameyVarfalamey Posts: 8  Junior Member
    And after another reboot of nas there only one way to use Samba Tweaks - reinstall it. What should I check additionally?
  • MijzelfMijzelf Posts: 1,073  Heroic Warrior Member
    I really don't know. On my box I can see in top that the different config file is applied. And I don't see how reinstalling would do something different than dis- and enabling Tweaks or dis- and enabling this specific Tweak.
    Unless you have something strange in your custom smb.conf, causing side effects.
Sign In or Register to comment.