We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

Can't detect the samba share.[Resolved]



  • @Enrico-Trevisanello I attempted to use the code you posted, and am getting an error.

    uci set samba.@samba[0].interface='eth* 192.168.1.100/255.255.255.0'
    "uci: Parse error (invalid command) at line 3, byte 1"



  • @Brad-Buskey oh sorry, I'm a beginner too and I don't know what's not working there. Actually, I edited the file /etc/config/samba directly using 'vi', this is how its general section looks like now:
    0_1486107516027_Screen Shot 2017-02-03 at 08.37.59.png



  • @Enrico-Trevisanello Sweet! That worked like a charm. showed up immediately after restarting the service.

    However, while I can view, I cannot actually enter the directory. It will not accept my userid/password.



  • Am I not able to connect as 'root'? Do I need to create a new user account in order to allow access?



  • as i remember from playing around with samba, that you can grant the rights for root in the configuration. Just might be a security issue?!



  • Thank you @Enrico Trevisanello!

    The following worked for me:
    uci set samba.@samba[0].interface='eth* [YOUR_CLIENT_IP]/[SUB_NET_MASK]'
    uci commit samba
    /etc/init.d/samba restart

    I'm currently on 0.1.9 b150 firmware if that helps.



  • @Brad-Buskey yes! you have to! check (and modify) the the file /etc/samba/smb.conf.template
    this file is the template, as the name says itself, and is used to generate the actual config file /etc/samba/smb.conf every time the samba service starts (so also when you restart it).



  • @Enrico-Trevisanello Thank you. It works. I edited the /etc/config/samba directly. added the interface.



  • FYI: You can set '*' for the interfaces value, that way it will work for BOTH ethernet and wlan.

    I also created a /shared directory and an smb user to manage all the samba files. This is what I have now:

    root@Omega-72FF:~# cat /etc/config/samba
    config samba
        option 'name'                   'Omega'
        option 'workgroup'              'WORKGROUP'
        option 'description'            'Omega'
        option 'homes'                  '0'
        option 'interface'              '*' # <-- (wlan + ethernet)
    
    config 'sambashare'
        option 'name'           'shared'
        option 'path'           '/shared'
        option 'users'          'smb'
        option 'guest_ok'       'yes'
        option 'create_mask'    '0700'
        option 'dir_mask'       '0700'
        option 'read_only'      'no'
    

    Note that the smb user has to be created both as a system user AND samba user. This is done by editing the /etc/passwd file (add a line), setting the password for the newly created use (passwd smb) and creating the user at samba level with smbpasswd -a smb. Make sure you also do chown smb /shared so that this user owns the relevant directory.

    As per @Luciano-S coment above, the reason for going through all this malarchy is because the root user by default is prevented from being a samba user as well (I'm guessing because of the security risk).

    You can probably turn this off by commenting the relevant line in /etc/samba/smb.conf.template then setting root as your sambashare user instead.. but I was happier with the config above:

    [global]
        netbios name = |NAME|
        display charset = |CHARSET|
        interfaces = |INTERFACES|
        server string = |DESCRIPTION|
        unix charset = |CHARSET|
        workgroup = |WORKGROUP|
        local master = no
        browseable = yes
        deadtime = 30
        domain master = yes
        encrypt passwords = yes
        enable core files = no
        guest ok = yes
    #   invalid users = root  # hmmm.. is commenting this out a good idea?
        load printers = no
        map to guest = Bad User
        max protocol = SMB2


  • @Steven-de-Salas What is the line syntax for the new user in /etc/passwd

    It looks like User:?:?:?:user?:home-dir:shell
    I dont know the ? in the above?

    I almost have it, I just cant get authenticated.



  • @Brad-Buskey said in Can't detect the samba share.[Resolved]:

    I almost have it, I just cant get authenticated.

    I guess you have to tell us witch way you took. If you gave the user root full access you may not have to authenticate?



  • Just to see if I can get into the smb share, I commented out the Invalid User from the template.
    I created the root account in the smbpasswd
    I then attempted to connect to the share (via OSX) and was able to connect to the share.
    This gives me a list of the directories (I mapped it to '/')
    All of the directories, when I attempt to access them, return the following:
    "The folder 'root' can't be opened because you do not have permission to see its contents."

    I used the template above from Steven for the share, commenting out the "option 'users' line.

    Once I get the /etc/passwd worked out, I will go back to using a separate user for the samba, however I have a feeling I will get the same results (no access to any directory) anyway. So I want to get it working with root first.



  • @Brad-Buskey: I used this link to create my new /etc/passwd user, the result is as follows:

    smb:x:501:501:samba:/shared:/bin/ash
    

    My understanding is that this is equivalent to:

    [user]:[pwd]:[id]:[id]:[desc]:[home]:[shell]
    

    When running passwd smb the [pwd] component seems to get replaced by a hash of the password.

    Dont forget you also need to give user full access the the [home] directory. I used chown smb /shared to acomplish this.

    You can also verify samba auth locally before moving on to connect via your desktop:

    $ opkg install samba36-client
    ...(package download blah blah)...
    $ smbclient -L localhost -U smb
    Enter smb's password: ******
    
        Sharename       Type      Comment
        ---------       ----      -------
        shared          Disk
        IPC$            IPC       IPC Service (Omega)
    
        Server               Comment
        ---------            -------
        MEDIAHUB             WD TV Live
        OMEGA                Omega
    
        Workgroup            Master
        ---------            -------
        WORKGROUP            MEDIAHUB


  • @Steven-de-Salas Thanks! Will check this out when I get into work.



  • Everything is working now, I was missing a : on the created user in the passwd file.


Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.