Thursday, November 22, 2012

OpenWRT - Samba Server

Install samba36-server and luci-app-samba
# opkg install samba36-server
# opkg install luci-app-samba
Edit /etc/config/samba
# vi /etc/config/samba
config samba
        option name 'OpenWrt'
        option workgroup 'WORKGROUP'
        option description 'OpenWrt'
        option homes '0'

config sambashare
        option name 'dlna'
        option read_only 'no'
        option users 'diantokam'
        option create_mask '0777'
        option dir_mask '0777'
        option path '/home/dlna'
        option guest_ok 'yes'

config sambashare
        option name 'hidden$'
        option users 'diantokam'
        option read_only 'no'
        option create_mask '0777'
        option dir_mask '0777'
        option path '/home/old'
        option guest_ok 'yes'
Edit /etc/passwd and add user diantokam,copy paste user nobody configuration, leave everything same as user nobody, except for user ID and group name.
# vi /etc/passwd
root:$1$nvFplbd8$l05HR0mdTHcGprNaMg8QA1:0:0:root:/root:/bin/ash daemon:*:1:1:daemon:/var:/bin/false network:*:101:101:network:/var:/bin/false nobody:*:65534:65534:nobody:/var:/bin/false diantokam:*:65535:65534:diantokam:/var:/bin/false
Create password for user diantokam
# passwd diantokam
Adding diantokam to samba user
# smbpasswd -a diantokam
Enable samba service on startup
# /etc/init.d/samba enable
To start samba service
# /etc/init.d/samba start
To stop samba service
# /etc/init.d/samba stop
To accesses samba share from windows type \\samba_server_name on address bar, in my case it is \\openwrt



or using  \\ip_address in my case, it is \\192.168.1.1



and insert username and password for diantokam that you give for smbpasswd



Done.

12 comments:

  1. Setelah nyari sana sini, akhirnya postingan ini yang membuat Samba - ku bisa menari indah....:-) thanks banget ya, ditunggu sharing sharing berikutnya....

    ReplyDelete
  2. halo,
    bisa ga ya kita akses share folder kita ga usa pake username n password? soalnya waktu saya uda berhasil mount usb saya tapi dari windows pas mau diakses shared folder nya ga ada permission nya.

    thanks.

    ReplyDelete
  3. [global]
    ....
    null passwords = yes
    ....

    Edit /etc/samba/smb.conf.template dan tambahkan null passwords = yes:

    config sambashare
    option name 'public'
    option read_only 'no'
    option path '/home'
    option guest_ok 'yes'

    edit /etc/config/samba hapus option users 'nama_user' bila ada,

    ReplyDelete
  4. bro,
    masih tetep ga bisa nih. katanya ga ada permission utk akses folder yg gw shared. config nya kaya gini nih.

    /etc/config/samba



    config samba

    option name 'OpenWrt'

    option workgroup 'WORKGROUP'

    option description 'OpenWrt'

    option homes '1'



    config sambashare

    option name 'Sharing'

    option path '/home'

    option read_only 'no'

    option guest_ok 'yes'


    etc/samba/smb.conf.template



    [global]

    netbios name = |NAME|

    display charset = |CHARSET|

    interfaces = |INTERFACES|

    server string = |DESCRIPTION|

    unix charset = |CHARSET|

    workgroup = |WORKGROUP|

    browseable = yes

    deadtime = 30

    domain master = yes

    encrypt passwords = true

    enable core files = no

    guest account = nobody

    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 = yes

    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


    kalau ada yg kurang tolong ditambahin ya gan.
    thanks.

    ReplyDelete
  5. Nanti malam saya coba, besok mampir lagi ya, thq

    ReplyDelete
  6. Bisa kok dan berhasil untuk public share, ikuti cara yang telah saya jabarkan pada comment diatas, nih aku tulis ulang.

    [global]
    ....
    null passwords = yes
    ....

    Edit /etc/samba/smb.conf.template dan tambahkan null passwords = yes:

    config sambashare
    option name 'public'
    option read_only 'no'
    option path '/home'
    option guest_ok 'yes'

    edit /etc/config/samba hapus option users 'nama_user' bila ada,

    ReplyDelete
  7. Kalo lupa password gimana nih, Gan?
    Waduh, kira2 bisa ganti password gak yah?

    ReplyDelete
    Replies
    1. Coba di ketik lagi di putty nya
      smbpasswd -a (user) nnti dia minta password yang baru atau tambahin null passwords = yes

      Delete
  8. Kalo gaada permission coba buka putty login lewat ssh , ketik chmod 777 (folder)

    ReplyDelete
  9. Thank you bto aal karena sudah membantu menjawabnya:
    smbpasswd -a diantokam digunakan untuk menambahkan user baru ke samba, bisa juga dipakai untuk mereplace user yang sudah ada. Setelah kita menambahkan user baru samba akan menanyakan password baru untuk user tersebut.

    Nah, pada bagian ini silahkan isi dengan password yang dikehendaki.

    Terima kasih semua

    ReplyDelete
  10. Sangat membantu

    Thanks

    Semoga makin sukses

    ReplyDelete