Results 1 to 9 of 9

Thread: N5200B Pro, Manually Configuring Samba

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    6
    Thanks
    0
    Thanked
    0 times in 0 posts

    N5200B Pro, Manually Configuring Samba

    Hi,

    I am trying to manually configure the Samba config file to only allow access from a range of IP addresses by adding the following lines to the [Global] section:

    hosts allow = 127.0.0.1 192.168.50.0/24
    hosts deny = 0.0.0.0/0

    I am editing the /raid/sys/smb.conf file. However, everytime I restart Samba using the command /img/bin/rc/rc.samba restart, the changes I made to the smb.conf file do not stay. It reverts back to the config file as it was before I made any changes.

    How do I make the changes to /raid/sys/smb.conf stay and actually be implemented by Samba? Thanks!

  2. #2
    Registered+
    Join Date
    Aug 2007
    Location
    Ilmenau / Jena
    Posts
    73
    Thanks
    1
    Thanked
    0 times in 0 posts

    Re: N5200B Pro, Manually Configuring Samba

    you probably need to overwrite the config everytime samba is started - by an own module which is executed after that and does nearly the same but use your config file...

    I guess it should look much like the ssh module and the rootpw module (at least kindof)
    Hardware mods:
    # they void your warranty
    # they may seem to work, but kill your machine later on
    # they are mostly unneeded, because the engineers who built a machine knew what they were doing...

  3. #3
    Registered+
    Join Date
    Aug 2007
    Posts
    53
    Thanks
    0
    Thanked
    3 times in 3 posts

    Re: N5200B Pro, Manually Configuring Samba

    The samba configuration file stays - at least on my device.

    In the samba start script there is nothing which reverts the samba conf file.

    It must be something else why it's not working for you.

    Andreas

  4. #4
    Senior Member
    Join Date
    Jun 2007
    Location
    Austra
    Posts
    453
    Thanks
    0
    Thanked
    14 times in 14 posts

    Re: N5200B Pro, Manually Configuring Samba

    There seems to be a kind of health check in the 2.xx Firmwares, which rewrites the smb.conf file on restart (I remember one user havig these problems too, but can't remember exactly the thread or the forum where it was)
    br
    Peter

  5. #5
    Registered User
    Join Date
    Aug 2007
    Posts
    6
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: N5200B Pro, Manually Configuring Samba

    Hey, thanks for the responses. FYI I am running firmware 2.00.02.2, and dug a little deeper into why my smb.conf file is being overwritten. Unfortunately, my scripting experience is very limited, but these are some relevant portions (I think) that I pulled out of /img/bin/rc/rc.samba:

    Under where samba_start() is defined:
    if [ -x ${smbhome}/sbin/smbd -a -x ${smbhome}/sbin/nmbd -a -r /etc/samba/smb.conf ]; then
    sync


    And then I think this is where "sync" is defined:
    sync
    if [ "$apply_ad" != "1" ] && [ "$1" != "stop" ];
    then
    /img/bin/rc/assemble_conf
    fi


    So it appears that when Samba starts, it looks to make sure the smb.conf file is there, then it runs the script /img/bin/rc/assemble_conf. I looked into that script and it just builds up a temporary Samba config file from scratch, replaces /etc/samba/smb.conf file with that temporary config file, and then symbolically links /etc/samba/smb.conf to /raid/sys/smb.conf.

    Please correct me if I am wrong in my analysis as I am trying to learn a little about Linux as I fool around with my Thecus box. It appears I could put in the relevant lines into the "assemble_conf" script and be good to go, but whenever I try to edit it, it says that the file is read-only. Is there any way I can get around that?

    Thank you!

  6. #6
    DR
    DR is offline
    on ye old ship HEXUS DR's Avatar
    Join Date
    Jul 2003
    Location
    HEXUS HQ, Elstree
    Posts
    13,412
    Thanks
    1,060
    Thanked
    841 times in 373 posts

    Re: N5200B Pro, Manually Configuring Samba

    How do you SSH to your Thecus?

  7. #7
    Senior Member
    Join Date
    Jun 2007
    Location
    Austra
    Posts
    453
    Thanks
    0
    Thanked
    14 times in 14 posts

    Re: N5200B Pro, Manually Configuring Samba

    Quote Originally Posted by DR View Post
    How do you SSH to your Thecus?
    You have to install 2 modules SSHD and SYSUSER - You find the modules and others on the Thecus Wiki pages: http://onbeat.dk/thecus/index.php/Main_Page
    br
    Peter

  8. #8
    Senior Member
    Join Date
    Jun 2007
    Location
    Austra
    Posts
    453
    Thanks
    0
    Thanked
    14 times in 14 posts

    Re: N5200B Pro, Manually Configuring Samba

    Quote Originally Posted by ishieh84 View Post
    Hey, thanks for the responses. FYI I am running firmware 2.00.02.2, and dug a little deeper into why my smb.conf file is being overwritten. Unfortunately, my scripting experience is very limited, but these are some relevant portions (I think) that I pulled out of /img/bin/rc/rc.samba:

    Under where samba_start() is defined:
    if [ -x ${smbhome}/sbin/smbd -a -x ${smbhome}/sbin/nmbd -a -r /etc/samba/smb.conf ]; then
    sync


    And then I think this is where "sync" is defined:
    sync
    if [ "$apply_ad" != "1" ] && [ "$1" != "stop" ];
    then
    /img/bin/rc/assemble_conf
    fi


    So it appears that when Samba starts, it looks to make sure the smb.conf file is there, then it runs the script /img/bin/rc/assemble_conf. I looked into that script and it just builds up a temporary Samba config file from scratch, replaces /etc/samba/smb.conf file with that temporary config file, and then symbolically links /etc/samba/smb.conf to /raid/sys/smb.conf.

    Please correct me if I am wrong in my analysis as I am trying to learn a little about Linux as I fool around with my Thecus box. It appears I could put in the relevant lines into the "assemble_conf" script and be good to go, but whenever I try to edit it, it says that the file is read-only. Is there any way I can get around that?

    Thank you!
    The file system where all the scripts are located is readonly. There exists a module - IMGDUP (author is omega who posted also in this thread), where all the read only section is copied to the raid and then the link is set to that - now writeable - filesystem.
    There are some users who uses IMGDUP to make modifications like that one You want to do.
    br
    Peter

  9. #9
    Registered User
    Join Date
    Aug 2007
    Posts
    6
    Thanks
    0
    Thanked
    0 times in 0 posts

    Re: N5200B Pro, Manually Configuring Samba

    Thank you both for pointing me towards the IMGDUP module. It works like a charm to edit /img/bin/rc/assemble_conf to put in the global settings that I want and the changes stay when I both manually restart Samba and when I just reboot the NAS.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Finding the right XP CD for my CD key
    By idlewild in forum Software
    Replies: 24
    Last Post: 17-03-2008, 01:53 PM
  2. Thecus N5200B Pro
    By Tark in forum SCAN.care@HEXUS
    Replies: 3
    Last Post: 04-07-2007, 05:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •