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:

Johan Rusli said...

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

Diantokam 甘忠仁 said...

senang bisa membantu :D

edwin said...

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.

Diantokam 甘忠仁 said...

[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,

Edwin said...

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.

Diantokam 甘忠仁 said...

Nanti malam saya coba, besok mampir lagi ya, thq

Diantokam 甘忠仁 said...

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,

Unknown said...

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

Unknown said...

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

Unknown said...

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

Diantokam 甘忠仁 said...

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

Unknown said...

Sangat membantu

Thanks

Semoga makin sukses