OpenWrt Forum Archive

Topic: Help with Samba

The content of this topic has been archived on 4 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi there,
I am having problems configuring samba:
either I configure access with "allowed users = root" and  "allow guests = yes", or I get an error
"samba is not accessible you might not have permission bla bla" when I try to open the share on windows.


after quite a bit of messing around, the current status of /etc/config/samba is:

config samba
        option name 'PandoraBox'
        option homes '1'
        option autoshare '1'
        option workgroup 'DEBFA'
        option description 'PandoraBox NAS shares'

config sambashare
        option name 'root'
        option path '/'
        option read_only 'no'
        option guest_ok 'yes'
        option create_mask '0700'
        option dir_mask '0700'
        option users 'root'

config sambashare
        option auto '1'
        option name 'sdb1'
        option path '/mnt/sdb1'
        option read_only 'no'
        option create_mask '0700'
        option dir_mask '0700'
        option users 'root'
        option guest_ok 'yes'

config sambashare
        option auto '1'
        option name 'sda1'
        option path '/mnt/sda1'
        option read_only 'no'
        option guest_ok 'yes'
        option create_mask '0700'
        option dir_mask '0700'
        option users 'root'

the status of /etc/samba/smb.conf is:

[global]
        netbios name = PandoraBox
        display charset = UTF-8
        interfaces = 127.0.0.1/8 lo 192.168.1.1/24 br-lan
        server string = PandoraBox NAS shares
        unix charset = UTF-8
        workgroup = DEBFA
        browseable = yes
        deadtime = 30
        domain master = yes
        encrypt passwords = true
        enable core files = no
#       guest account = nobody
        guest account = root
        guest ok = yes
#       invalid users = root
        local master = yes
        load printers = no
        map to guest = Bad User
        max protocol = SMB2
        min receivefile size = 16384
        null passwords = no
        obey pam restrictions = yes
        os level = 20
        passdb backend = smbpasswd
        preferred master = yes
        printable = no
        security = user
        smb encrypt = disabled
        smb passwd file = /etc/samba/smbpasswd
        socket options = TCP_NODELAY IPTOS_LOWDELAY
        syslog = 2
        use sendfile = yes
        writeable = yes

[homes]
        comment     = Home Directories
        browsable   = no
        read only   = no
        create mode = 0750

[root]
        path = /
        valid users = root
        read only = no
        guest ok = yes
        create mask = 0700
        directory mask = 0700

[sdb1]
        path = /mnt/sdb1
        valid users = root
        read only = no
        guest ok = yes
        create mask = 0700
        directory mask = 0700

[sda1]
        path = /mnt/sda1
        valid users = root
        read only = no
        guest ok = yes
        create mask = 0700
        directory mask = 0700

any help would be appreciated smile smile

Thank you!

That is a 50 minutes clip, and as far as I can tell I already tried everything in there... can you please be a little more specific as about what you think is wrong with what I am doing?
I will post configuration files after I re-edit to mimic the youtube video smile

@fbpublic, You could be a bit more clear on your issues.  I am not sure of your goals, what you installed (or not) and exactly the problem.  There are 3 wiki pages, https://wiki.openwrt.org/start?do=search&id=samba  have you read them all?

Hi,
what I am trying to achieve is> login with user fa + password works, login with any other id/pw doesn't work.
Ideally I would like not to set a 777 permission (contrary to youtube clip above).

After following the guide I have:

FSTAB:

config global
    option anon_swap '0'
    option anon_mount '1'
    option auto_swap '1'
    option auto_mount '1'
    option delay_root '5'
    option check_fs '1'

config mount
    option target '/mnt/sda1'
    option uuid '0320d0be-060d-4f95-978c-c25032bd43f0'
    option enabled '1'

config swap
    option device '/dev/sda2'
    option enabled '1'

config mount
    option enabled '1'
    option label 'Seagate 1TB Black'
    option target '/mnt/sda1'
    option enabled_fsck '1'

/etc/config/samba:

config samba
    option name 'PandoraBox'
    option homes '1'
    option autoshare '1'
    option workgroup 'DEBFA'
    option description 'PandoraBox NAS shares'

config sambashare
    option name 'root'
    option path '/'
    option read_only 'no'
    option guest_ok 'yes'
    option users 'fa'
    option create_mask '0777'
    option dir_mask '0777'

config sambashare
    option auto '1'
    option name 'sdb1'
    option path '/mnt/sdb1'
    option read_only 'no'
    option guest_ok 'yes'
    option users 'fa'
    option create_mask '0777'
    option dir_mask '0777'

config sambashare
    option auto '1'
    option name 'sda1'
    option path '/mnt/sda1'
    option read_only 'no'
    option guest_ok 'yes'
    option create_mask '0777'
    option dir_mask '0777'
    option users 'fa'

/etc/group:

root:x:0:
daemon:x:1:
adm:x:4:
mail:x:8:
audio:x:29:
www-data:x:33:
ftp:x:55:
users:x:100:
network:x:101:
nogroup:x:65534:
fa:*:65534:

/etc/passwd:

root:x:0:0:root:/root:/bin/ash
daemon:*:1:1:daemon:/var:/bin/false
ftp:*:55:55:ftp:/home/ftp:/bin/false
network:*:101:101:network:/var:/bin/false
nobody:*:65534:65534:nobody:/var:/bin/false
fa:*:1000:65534:fa:/mnt:/bin/false

/etc/shadow:

root:$1$cat[......]LnwP1:16965:0:99999:7:::
daemon:*:0:0:99999:7:::
ftp:*:0:0:99999:7:::
network:*:0:0:99999:7:::
nobody:*:0:0:99999:7:::
fa:$1$eIpad[......]2e4.mqBFy.0:0:0:99999:7:::

smbpasswd:

fa:1000:XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:6B[......]1B1:[U          ]:LCT-00000001:

The result with this file is the error in the first message. If I just change the sambashare user from fa to root, everything works, but I do not get any type of security, just free complete access to any user.
Let me know if need any more info smile

Thank you,
Fa

(Last edited by fbpublic on 17 Jun 2016, 19:28)

ps: yes, I did read the 3 configuration pages you mention, they don't help much for what I am trying to get

Does your 'guest ok' value need to change to use a password?  I think this should be no.
See section 4 at the bottom. https://wiki.openwrt.org/doc/uci/samba# … vel.access
Not clear if you also need to change this in the smb.conf

Also I notice above you have a samba share of sdb1, but no corresponding mount section in fstab.

Hi RangerZ,
if I disable "guest OK", or I change the user to anything else than root, I loose access to the share.
I am not worried about sdb1 at the moment, it has an automount setting somewhere, but I don't use it anyway smile

Perhaps a google elsewhere delivers a solution.

The discussion might have continued from here.