Friday, June 25, 2010

Samba the File Share Server in DD-WRT

It's not an easy job to configure Samba share in standard DD-WRT because by default, the /etc folder is read-only. So before start, please following the previous tutorial to set a writable /etc. Also, might to your surprise, DD-WRT does have a Samba3 built in the firmware and it works just fine. In this article, you'll be guided through the whole process to set up a password protected samba share with customized username/password.

  1. Check if there is a Samba server built in
    Log in the router, then run
    smbd --version
    Output should be "Version 3.0.24", which means the firmware has Samba 3.0.24 included.
    If the Samba server is missing, install it by running
    opkg install samba3

  2. Add dedicated users for Samba
    For security reasons, I strongly suggest NOT to use "root" to access your Samba share. Instead, here we'll create users for Samba(and ftp) only with minimal privilege and no login shell.
    First, add the following lines to file /etc/passwd


    Save the /etc/passwd file, then run
    passwd share

    to change the password for user "share".  Now check the content of the updated /etc/passwd file, the line for user "share" will look like:


    The red part is the encrypted password. In the example line above, the password is also set to "share".

    To make the change permanent,  create a new script /opt/etc/init.d/adduser

    grep -q nobody /etc/passwd || echo 'nobody:x:65534:65534:nobody:/mnt:/bin/false' >> /etc/passwd
    grep -q share /etc/passwd || echo 'share:$1$2zhNidn9$DJK7SG8aqMg2hDsBYv6yZ.:65534:65534:share:/mnt/share:/bin/false' >> /etc/passwd

    Don't forget to change the red part. Then set it to run during boot up:
    chmod a+x /opt/etc/init.d/adduser
    ln -s /opt/etc/init.d/adduser /opt/etc/init.d/S05adduser

    The Home folder for user share will be /mnt/share, create it if its not present.

    mkdir -m 777 /mnt/share

    Then use smbpasswd to add a samba user with username "share" and password "share"

    mkdir /etc/samba
    touch /etc/samba/smbpasswd
    smbpasswd share share

    #replace the red part with your own password

    Copy the newly created /etc/samba/smbpasswd to /opt/etc/samba/smbpasswd to keep the /etc/ folder clean and in the future all configuration files will be stored in /opt/etc/samba folder. Please leave /etc/samba folder there(don't delete it) as its also required by Samba.

    mkdir -p /opt/etc/samba/
    cp -a /etc/samba/* /opt/etc/samba/
    chmod 644 /opt/etc/samba/smbpasswd

  3. smb.conf, the configuration file for Samba
    Use vi or nano, create file /opt/etc/samba/smb.conf with contents below:

            netbios name = DD-WRT
            workgroup = WORKGROUP
            server string = DD-WRT
            syslog = 10
            encrypt passwords = true
            passdb backend = smbpasswd
            obey pam restrictions = yes
            socket options = TCP_NODELAY
            preferred master = no
            os level = 20
            security = user
            guest account = nobody
            invalid users = root
            smb passwd file = /opt/etc/samba/smbpasswd
            unix charset = UTF-8
            dos charset = UTF-8
            comment = Home Directories
            browseable = no
            read only = no
            create mode = 0750
            path = /mnt/
            read only = no
            guest ok = no
            create mask = 0700
            directory mask = 0700

    Now test the file by running

    smbd -s /opt/etc/samba/smb.conf

    and access the Samba server by typing \\ in the address bar. Login with user "share". You should see two folders: "Share"(/mnt/share) and "USBDrive"(the whole /mnt folder).

    For Windows Vista/7 machine, a compatibility bit must be set to work with the Linux Samba share. See the end of the post.

  4. Run Samba as a service
    If everything works out, it's time for the startup script
    Create file /opt/etc/init.d/samba(delete all previous contents if its not empty).

    kill -9 $(pidof smbd)
    kill -9 $(pidof nmbd)
    /usr/sbin/smbd -s /opt/etc/samba/smb.conf
    #if you installed samba3 through opkg, use
    #/opt/bin/smbd -s /opt/etc/samba/smb.conf

    Then set it to run upon bootup:

    chmod a+x /opt/etc/init.d/samba
    ln -s /opt/etc/init.d/samba /opt/etc/init.d/S50samba

  5. (Optional)Fix Samba and Windows Vista/7
    When accessing Samba from a Windows Vista/7 machine, the password will always be rejected regardless whatever you input. That's because the Samba we used here does not support the new password authorization scheme in Windows.
    To fix:
    Run secpol.msc
    Go to: Local Policies -> Security Options
    Find "Network Security: LAN Manager authentication level" and change setting from "Send NTLMv2 response only" to "Send LM & NTLM - use NTLMv2 session security if negotiated"

    Some Windows versions may not have secpol.msc, in this case, save these 3 lines below to file sambafix.reg and run it:

    Windows Registry Editor Version 5.00

    Reboot the Windows to make the change take effect.


Anonymous said...

I've installed samba with opkg. /opt/usr/sbin/smbd -s /opt/etc/samba/smb.conf should be /opt/usr/bin/smbd -s /opt/etc/samba/smb.conf

leo.d said...

thanks for pointing this out. /opt/usr/sbin/smbd is wrong, but in my case its in /opt/bin/smbd (not /opt/usr/bin/smbd). Can you double check yours?

Anonymous said...

I followed all the steps in this tutorial and am still no able to access the samba shares from either Windows 7 (I changed the "LAN Manager authentication level" as per the guide) or Ubuntu 10.04. I am able to see the two shared folders ("/mnt" and "/mnt/share" but when I click on the folders I get a message that "Network access is denied". The shares are properly mounted and accessible via ftp/sftp. I am using the latest build (14684).

leo.d said...

did you get the password input prompt? and try to change the permissions of the /mnt and /mnt/share folder

chmod 777 /mnt
chmod 777 /mnt/share

Anonymous said...

Yes, I do get a password input prompt. Once I enter the username/password combo, it shows me the two folders (/mnt and /mnt/share). But when I try to access either of the folders, it does not let me do so.

And yes, both of my folders are chmoded to 777. Not sure what the problem is as I am an experienced Linux user and everything looks OK to me.

As an aside, after some fuss, I managed to get ushare to work properly. It is now sharing media over the network and I am able to access it using a PlayStation 3. If you are interested, I could email you the steps to get it working and you could add it to the blog for anyone who needs a media server on their router.

leo.d said...

The error arises from some wrong permission settings(especially with ntfs/fat folders) but other than that, i'm clueless...

and yes, please share the ushare totorial. I don't use it but it can definitely be of help to many! you may just post the steps here as a comment, or at dd-wrt forum. thanks.

ccdoggy said...

I have it to a point where windows xp can connect and transfer files just fine, windows 7 can login and see the share folders but not list whats in the folders nor copy anything into the folders. it errors out with something about the path is not found. I have not spent too many hours on it yet but about to start focusing on it soon.

Just wondering if anyone has any ideas or clues as to what could be the problem...

Also I would REALLY like to get a uShare install and config writeup also. I tried it and it failed to install for some reason or another, being that i am not too adept with linux it might be out of my reach on my own. Also the previous version of ushare i had installed would eat up all the ram when a transfer started which rendered the router slow.

Kev said...

What is the reason for this script? I'm confused, can you clarify?

grep -q nobody /etc/passwd || echo 'nobody:x:65534:65534:nobody:/mnt:/bin/false' >> /etc/passwd
grep -q share /etc/passwd || echo 'share:$1$2zhNidn9$DJK7SG8aqMg2hDsBYv6yZ.:65534:65534:share:/mnt/share:/bin/false' >> /etc/passwd

Eddo said...

Leo; you're right. /opt/bin/smbd is the right path to the samba daemon.

Question: I can't see the name of my shares in Windows XP. I guess it's because nmbd won't run with samba3? Do you have any suggestions?

Matthis Rouch said...

Just like Vista, Mac os X (10.6) seems to refuse to connect too... does anyone know how to fix that?


Matthis Rouch said...

To answer my question for Mac OS X:
Login in using login name "SHARE" worked... strange, because I set up as "share".

ccdoggy said...

THANK YOU Matthis! I spent way too long trying to figure out how to get windows 7 to play nice with it and logging in with all caps is what finally fixed it after hours of searching.

enzo said...

Does this version of Samba support large files (>4GB). It does not appear to do so.

ccdoggy said...

This samba is version 3.0.24 which means it will support large files just fine.

Anyone know if there is a more current version of Samba available for these routers? 3.0.24 came out some time in 2007 and does not play with windows 7 very well.

Anonymous said...

Thanks for the tutorial. But I really need a NFS server on that router to record TV shows with my DBox2. Is there any chance?

a+rwx said...

add to smb.conf:
log file = /opt/var/log/samba/log.%m
max log size = 100

check your logs, if you have something like "can't resolve symbol"

opkg install libc

Anonymous said...

I'm also expecting that since this is a samba3, it would support files >4G. But I found the same problem as enzo. When I try to copy a file >2G to the ext3 disk via samba, it prompts error something like "disk is full", but I do have enough space and other files are still able to be transferred correctly.

Any clue?

Anonymous said...

I did every thing ok ,but after restart router I can not access my router.
it say that (windows con not access \\
Error code 0x80070043.
if I want to samba I have to to from begining
from Add dedicated users for Samba to Now test the file by running

smbd -s /opt/etc/samba/smb.conf

Anonymous said...

after I reboot router I have to copy 3 line



/share:/bin/false to etc/passwd if I not copy I can not samba
this line
I copy from /opt/etc/init.d/adduser
so how to fix this bug

Anonymous said...

I also am getting disk full messages when trying to place large files on the share. No problems with small files though.

ccdoggy said...

I have no problems with 4.5+ gig files.

make sure you format the drive in ext3. its the safest and easiest for the firmware to work with.

ccdoggy said...

It seems like as the router is booting up it is not running the scripts to add users and then to start samba. in my dd-wrt startup commands I have added (make sure its below where you mount the drive(s)):

sh /opt/etc/init.d/adduser

That makes it add the users to the passwd file. however i have not been able to get it to start samba even if i add:

smbd -D -s /opt/etc/samba/smb.conf

to the end of the startup script. however if i telnet into the router and do the same command I listed above for smbd it starts right up and works. odd.

If you are having problems with windows 7 accessing the shares, mounting it works but just accessing it does not because it lists the directories as empty and inaccessible, then you need to add in the global section:

host msdfs = no

I believe because its trying to do this 'Microsoft Distributed File System' MSDS thing which is causing the shares to actually point anonymous people to an incorrect location.

Anonymous said...

when I run sh /opt.etc/init.d/adduser
it say that
/opt/etc/init.d/adduser: line 2 nobody:x:65534:65534:nobody:/mnt:/bin/false not found

/opt/etc/init.d/adduser: line 5 share:$1$2zhNidn9$DJK7SG8aqMg2hDsBYv6yZ.:65534:65534:share:/mnt/share:/bin/false
so what it mean.

Anonymous said...

@ccdoggy Hmmm...I believe my router already had samba loaded on it from the original dd-wrt install. I wonder if that has something to do with it not supporting 2+GB files. I just checked the version and it was the same version number so I didn't bother downloading it from the opkg repository. Can anyone verify that the base dd-wrt samba doesn't support 2+ GB files and the opkg version of samba DOES support 2+ GB files?

My only other problem is that I have a seagate freeagent 750gb drive hooked up to it and unfortunately the power saving features on the drive cause it to spin down and sleep and does something crazy. When it tries to wake back up it doesn't reconnect properly which in turns sort of screws up my install and settings. Nothing I can do besides buy a new external drive that works correctly under linux.

Anonymous said... support 2+GB, I download 1 file 3.6GB and I copy it to my computer ok.
I connect wzr hp G 300 NH with usb 8GB only

Anonymous said...

I have confirmed my 2+GB file problem to be with the samba installation that came with DD-WRT v24 Pre SP2 Build 14402. I installed Samba through opkg and re copied my config files (as they were overwritten when I reinstalled samba), then ran the ORIGINAL samba and had the problem. I then killed samba and then ran samba from /opt/bin/smbd and now it works with files larger than 2 and 4GB. hopefully this helps with the confusion some people are having with file sizes.

Jockl said...
This comment has been removed by the author.
Jockl said...
This comment has been removed by the author.
Jockl said...

Well, i had some problems with this. But it was always either my fault or the software matter.

I made some mistakes because i copy&pasted all the commands (yeah i know, but tbh this blog is stealing my linux virginity.. and i begin to like it!) all i can say to other copy&pasters: there are line breaks that shouldnt end up in the script files.

The other problem i had was that i didnt even get a command prompt in win7 using firefox.
Well i still dont get it but It just doesnt work on firefox, IE works.. Thats bad i hope i will find the reason. If i cant i need to find another browser (IE isnt an option). Maybe chromium :P

Thanks a bunch for this blog and the tutorials that really made me curious about linux. Good job and keep em coming <3

antking3806 said...

OK I cant figure out what I'm doing wrong as of now no matter what I do when the router is rest the passwd file loses the info about the nobody/user stuff I put in there. Not Sure what I over looked there was some confusion about what line to use in step 4 I'm runing the opkg one. But if I renter the passwd info and smbd -s /opt/etc/samba/smb.conf everything works. any help?

antking3806 said...

ok I managed to get the nobody/user stuff in there I didn't realize that there is only two lines and they shouldn't be broken up (step 2). But when it does put the code in it refuses to give me access to the drive. if I start without the code in there then copy it over via SCP after the start up and type in smbd -s /opt/etc/samba/smb.conf everything works great is it possible to start it without a password? or to put the password some place else?

antking3806 said...

Samba is working fine now start up and every thing I downgraded the WRT160NLs FW from 14864 to 14311 and it just worked. thanks again

antking3806 said...

It stopped working again the first few times it worked then it stopped I noticed that when it worked I had to log in with user name and pass as share/share then when it started the auto login I stopped getting access to the files ... your thoughts?

antking3806 said...

I fixed it and it works fine now I put in a start-up file called sharestart I put the following in the file

export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib:/opt/usr/local/lib'
export PATH='/sbin:/opt/bin:/opt/usr/bin:/opt/sbin:/opt/usr/sbin:/bin:/usr/bin:/usr/sbin:/opt/usr/local/bin'
export PS1='\[\033[01;31m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'
export TERMINFO='/opt/usr/share/terminfo'
/mnt/opt/bin/smbd -s /opt/etc/samba/smb.conf

this way it was just like typing the smbd -s /opt/etc/samba/smb.conf line from the putty prompt with the added colors so you know it's working(If you tried the walk through then you know what I mean). Then I set the sharestart file to start after samba starts.
Samba starts at s50samba and then sharestart starts at s55sharestart.

I'm sure there is a better way to do it but I really don't know what I'm doing so I kept reading and trying and this just happens to work If anyone else has tried the walk through and had the same problem hit me up and I'll try to explain it better. :D

Maicom said...

I don't know Why.. but when I enter the diretory, nothing is show... the folder is empty... I'm tired to find a solution about this...

Anybody knows what I have to do for it's work right?

antking3806 said...

what router are u using and what step are you on?
did you do Software Installation on DD-WRT Part 1 and 2? those need to be done first before you get to installing samba3

Anonymous said...

Thank you so much.
I've been struggling to get it right using DD-wrt wiki and forum. But with your manual, it's a piece of cake.


Maicom said...

I'm using the TP-LINK TL-WR1043ND Version 1.6.
Yes I installed software as explained on DD-WRT Parte 1 and 2, and it's ok, install samba3 too...
The problem is that I see the two directore (share and USBDrive) But in Windows 7 they're empty and I can't save any file there. In Windows XP when I try access, it show access denied.
I had already tried to use login in all caps, but it didn't work...

I don't know what to to for samba work...

If you have any idea what I have to do, please tell me.

Anonymous said...

did it work when you did the test by typing in
smbd -s /opt/etc/samba/smb.conf
at the colored command prompt?

Maicom said...

When I type: smbd -s /opt/etc/samba/smb.conf
Nothing message appears, no error, no message..
Yes the command prompt is colored :p

Have any idea what happend?

Thanks for your reply!

Anonymous said...

OK I have no idea about windows 7 because I don't have windows 7 sorry. After you start up putty with the colored command prompt type in ps to see whats running if it says that smbd -s /opt/etc/samba/smb.conf is running then go into /opt/ect/init.d/Samba and put a "#" in front of the line
/opt/bin/smbd -s /opt/etc/samba/smb.conf
so it should look like this
#/opt/bin/smbd -s /opt/etc/samba/smb.conf
save and reboot the router get back in putty and type in ps to see what's running there should be no /opt/bin/smbd -s /opt/etc/samba/smb.conf
running then type in smbd -s /opt/etc/samba/smb.conf hit enter and type in ps again to check it the smbd -s /opt/etc/samba/smb.conf file is running
go into your network and try to access your shared file if you can let me know if you can't I'm at a lose.

Maicom said...

Thanks for your reply...
So... when I typed ps the smbd -s... were running
I did all your instructions... so It continuos showing only the empty folder (share and USBDrive) when I use the windows 7. If I use the windows XP I can see the same folders but when I try to acess one, it say that I don't have permission to access.

Do you have any idea?


Maicom said...

Hey... I try again what you say... I do it:
go into /opt/ect/init.d/Samba and put a "#" in front of the line /opt/bin/smbd -s /opt/etc/samba/smb.conf
and after reboot:
running then type in smbd -s /opt/etc/samba/smb.conf hit enter

Now it's work in Windows XP :p

but I don't understand... why it? the command was been running throught the opt/ect/init.d/samba...

what happend? Can you explain me?


( now I want to give it automatic.. how to do ? the samba file don't work? )

If somebody can say me what I have to do for it work in windows 7.. I'll be grateful..


Anonymous said...

check the /etc/passwd file to ensure that the
share:$1$2zhNidn9$DJK7SG8aqMg2hDsBYv6yZ.:65534:65534:share:/mnt/share:/bin/false line is there.
completely remove
/opt/bin/smbd -s /opt/etc/samba/smb.conf
from the /opt/ect/init.d/Samba file
reboot the router start putty and type in
smbd -s /opt/etc/samba/smb.conf
at the command prompt press enter then close putty and try to access the share folder if it still denies you access I don't think I can be much help.
Keep in mind the reason for removing the line /opt/bin/smbd -s /opt/etc/samba/smb.conf
from the /opt/ect/init.d/Samba file is so samba doesn't auto start. After you take it out when you reboot the router the "smbd -s..." should not be running. You should start it manuely be typing in the command smbd -s /opt/etc/samba/smb.conf at the colored prompt in putty.
I was having this problem too on mine it turned out to be that when it auto ran /opt/bin/smbd -s /opt/etc/samba/smb.conf from the S50samba file it would not give me access. but if I removed /opt/bin/smbd -s /opt/etc/samba/smb.conf from the samba file and reboot the router I could type in the command smbd -s /opt/etc/samba/smb.conf and every thing would work.

Maicom said...

Hey ... Thanks so much for all your reply..

I understand now something... I want to share with you..

for you have the /opt/bin/smbd -s /opt/etc/samba/smb.conf working withou have to digit it.. you can add at the save startup on the web gui - administration - command
It's work fine..

It don't work at the samba file because if you want to it.. you have to add samba like a service.. with start and stop option.. :p

It's safe you delete the file /opt/etc/init.d/samba :p

My problems now is only with windows 7!

Anonymous said...

Okay hope I helped like I said earlier I can't help with windows 7.

Eddo said...

Adding host msdfs = no to smb.conf did the trick for me with Windows 7. Thanks!

antking3806 said...

After installing this I realized I don't know how to properly shutdown/reboot with this program running and "stopping" the usb drive to insure I don't damage them does anyone have some insight on this?

ccdoggy said...

to shut down a program type in 'killall name' where name is the name of the program. ex: killall smbd

Yes it might not be the most proper way of shutting it down but it works.

As far as stoping the usb drive you can try to unmount it by using the command 'umount' but it might not let you as samba might be always using it (more like monitoring? it). Personally if i need to remove the drive i just kill smbd and unplug the drive. as long as its in Ext3 i am not too worried about it.

thorwald said...

hey anonymous(s) / ccdoggy

i'm experiencing exactly what anon did - the added share users:
don't stick in /etc/pswd

and start up scripts don't start, but if i add the lines after every reboot and then start samba, i'm back in business.

antking - what's the contents of your s55sharestart -file - perhaps that could help here?

antking3806 said...

first try this the way step 2 is written might throw you off a bit. There are only two lines there the first one is
grep -q nobody /etc/passwd || echo 'nobody:x:65534:65534:nobody:/mnt:/bin/false' >> /etc/passwd

the second is

grep -q share /etc/passwd || echo 'share:xxxxx:65534:65534:share:/mnt/share:/bin/false' >> /etc/passwd

with your proper code to fill in the "xxxxx"
At first when I was typing it in I put them on different lines like it was written in the how to but when I just used two lines it worked and stayed in my /etc/passwd file.

s55sharestart is a link to sharestart and sharestart has the following lines in it

export LD_LIBRARY_PATH='/opt/lib:/opt/usr/lib:/lib:/usr/lib:/opt/usr/local/lib'
export PATH='/sbin:/opt/bin:/opt/usr/bin:/opt/sbin:/opt/usr/sbin:/bin:/usr/bin:/usr/sbin:/opt/usr/local/bin'
export PS1='\[\033[01;31m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'
export TERMINFO='/opt/usr/share/terminfo'
/mnt/opt/bin/smbd -s /opt/etc/samba/smb.conf

hope this helps.

thorwald said...

thanks antking - yes, had interpreted the 2 lines as 4.

now at least samba starts, and etc/passwd is non-volatile

but i can't log onto a previously created share - only within (a) recreated session.

suspect something goes amiss on the step:
Then use smbpasswd to add a samba user with username "share" and password "share"

mkdir /etc/samba
touch /etc/samba/smbpasswd
smbpasswd share share

- as only once in a blue moon a new file gets created here with these steps - perhaps when i've taken the whole sequence from the top, not sure.

so it seems i'm in permissions hell. how much of that can be caused by altering the files with WinSCP's text editor as opposed to putty?

JP said...

Hey Antking.. You da man..

Adding that sharestart script was key for me..

I had no problems with passwords, etc. It just would NOT start samba no matter what.. which is strange because your all the other scripts in init.d work, including yours obviously..

Oh well, working now. I spent 3 freaking days on this.

BTW - For Mac users, you can't just enter \\ in a browser..

1. You need to go to Finder, Go, Connect to Server.
2. Then put smb:// and your are set..

antking3806 said...

@thorwald hey look at the post from August 12, 2010 8:44 PM I put it in as Anonymous try that and see if you can get in to your shared folder.
also the one from August 14, 2010 8:55 AM it goes into better detail.

thorwald said...

hey antking - u the man - i've now got it consistently working through multiple reboots. huh, shoulda just started from scratch instead of trying to fix what i had.

i suspect that my (and maybe your) permission troubles were caused by
multiple instances of smbd running simultaneously. even now that things are working, ps sometimes brings up two instances, but as long as at startup there's only one the share seems to be accessible.

next, i need to figure out how to serve the share's contents to the wwww...

but before that - something's wrong with this setup, the speed of the share is ridiculously slow, like 50 kb/s over a gigabit cable connection. yes, the drive is a USB stick, but with the stock firmware on the router i'd still get at least 1.5 Mb/s off the same stick...

antking3806 said...

Not sure whats going on with in now because I don't know enough about DD WRT to fix anything it took about a month to figure what i did out. hopefully some one with come by that can help sorry

thorwald said...

hey antking - sure. i think there's another tutorial about making the box into a web-server. will try that when hv some time to tinker.

i'd be curious to hear other people's speed test-results (crystal disk mark, etc.) the USB stick i'm using gives me 20Mb/s if direct-connected to an winXP box so the bottleneck is elsewhere. and i'm using ext2, that's supposed to be the lowest format-overheads.


Anonymous said...

Hi. I have followed all your tutorials. Samba mounts, I can connect using smb://server, however, when there is a prompt for log in, I receive username/password wrong, try again prompt.
Ps: Client is a Mac Os X Snow leopard. Any suggestions?

Anonymous said...

I modified the folder to /jffs and mounted another one of my flash drive with files to it. I can access the modified folder but it's not showing the files on the flash drive.
Can i fix this problem??

Anonymous said...

Just a quick question,
Is the samba swat interface installed by the opkg command??

Anonymous said...

You are a genius! Everything worked so fine! THANKS A LOT. YOU SHOULD WRITE EVERY TUTORIAL!

Thanks again. Best

Anonymous said...

Is the samba swat interface installed by the opkg command??

Anonymous said...

It is a long time that I'm trying to understend if is possible to add ntfs support to my TP-Link WR1043D.
It could appear a stupid question but I'm new in linux and ddwrt world and i'm getting crazy hanging around the forums.

If anybody could suggest me a guide, it'll be perfect!! ;)

Thank you everybody !

Anonymous said...

I receive "username/password wrong, try again prompt" on my mac OS X 10.6 as well.

how come?

David said...

I followed the instructions, and the only glitch I found was that the passwd command does not exist so I had to create the passwd string on another linux machine.

The router shares work great with Windows XP when accessed as \\router, where router is the DNS resolvable name of the router.

However I found that accessing shares as \\router don't with Windows 7, even after applying the registry patch and rebooting.

Malcolm's comments above are "I don't know Why.. but when I enter the diretory, nothing is show... the folder is empty... "

I see exactly that...if I view \\router, I can see the configured share directories there, but if I then double click any of the shares, I get empty share directories, even though on Windows XP it works fine.

However, if I access the shares as \\ (the ip address of the router in my network) it works just fine.

For some reason, accessing the shares as \\router under windows 7 don't work properly

Anonymous said...

If you want to mount an NTFS drive try installing the kmod-fs-ntfs or ntfs-3g packages. I haven't used either one but according to the performance will be pretty slow.

Jack said...

I've configured and installed everything like described in this post. Then I've mountet the dir via smbmount with the appropriate user and passwort in my ubuntu 10.04.

I am able to see every folder and every file contained in the shared directory, but have no right to create files! What's wrong? Directory rights are set up to 777 in /mnt/share.

Lum said...

I had lots of problems getting samba to work reliably. It would randomly start saying the shares were empty and other stupidity.

In the end I figured, since most tutorials here have you installing OpenWRT packages, why not just install OpenWRT?

It's literally two commands from the console to flash it to OpenWRT, documented on their Wiki. The basic web interface isn't wonderful, but it's enough to configure it to access the internet, then you can replace the default interface with x-wrt using opkg which you should already be familiar with, and install samba, transmission etc. etc. in the usual way, only without needing to hack any init scripts.

I've had it on for a week and no-way am I going back to DD-WRT now!

Max Pierson said...

Got it working, if you're having trouble stick with it. I've read elsewhere that you have to have Samba 3.5 to work with Windows 7, but this isn't true-- 3 works great with my Win 7 Pro x64.

Thanks for putting this together!

Anonymous said...

Thanks for the stock samba not support files over 2gb size confirmation.!!

indeed, it troubled me for some time, after installed again with opkg, it works very well.

the new installed samba3 perform batter too.

stock sambd average at 6-7mb/s, the new one at 10-11mb/s.

confirmed transfer 2.5gb single video file no problem, not yet testing file over 4gb size, assuming no problem either.

Max Pierson said...

If I want to give the 'share' user the ability to delete files, how do I do that? It's annoying to have to log in via putty to delete files.


Burke said...

When I try to access a password protected share windows (xp) prompts me with a username and password (guest) but wont let me change the account from guest (grayed out). Any ideas why this is happening?

Anonymous said...

I'm having problems seeing the share folders through windows network places. I'm trying to access the share folder through my media tank and the folders are not showing. I can type in \\ on windows xp and it shows the folder and it is accessible. It is just not showing automatically if I go to network places. Any ideas on how to fix it would be great.

Burke said...

make sure that samba is set to run the wins server. That might do the trick.

Max said...

I have the exact same problem with being able to access the shares via IP but not by the netbios name. I too though having the device be the wins server would solve the issue, but it didn't help. Any other ideas?

jackli said...

> my WZR-HP-G300NH router also have (not showing >4GB files) too!
> i think the build in samba is really crashed!
> and it is not come with passwd command too!
> just want to say thank you to your suggestion,
> it really work after installing opkg samba3!

Anonymous said...
I have confirmed my 2+GB file problem to be with the samba installation that came with DD-WRT v24 Pre SP2 Build 14402. I installed Samba through opkg and re copied my config files (as they were overwritten when I reinstalled samba), then ran the ORIGINAL samba and had the problem. I then killed samba and then ran samba from /opt/bin/smbd and now it works with files larger than 2 and 4GB. hopefully this helps with the confusion some people are having with file sizes.
July 27, 2010 6:52 AM

eriand said...

Hey guys!

Been searching for a solution for over a week now and cant get this to work. Partitioned the disk occording to the guide at and everything with opkg seams to work.

After installing everything occording to this guide and putting in the final command line i get nothing:

root@DD-WRT / $ smbd -s /opt/etc/samba/smb.conf
root@DD-WRT / $

and it seams like something might be running:
root@DD-WRT / $ ps | grep smbd
1985 root 2624 S N smbd -s /opt/etc/samba/smb.conf
5248 root 1452 S grep smbd

but i cant even get to the login screen. It dosent even respond to \\

would be soooo greatful if someone could push me in the right directon!

Anonymous said...

Hello, I'm trying to install samba on my dd-wrt and i`m having some difficulties. I can connect to \\ asking for user/pass) but its not accepting any password.
Also after I edited /etc/passwd with those 2 lines, I tried to do "passwd share" but I dont seem to have that command.

bogdan said...

Hi guys,

I have installed samba 3 on my wrt160nl, but i cant get to the login interface. it seems to be the same situation eriand encountered...

root@DD-WRT etc $ ps | grep smbd
1348 root 2172 S N /usr/sbin/smbd -s /opt/etc/samba/smb.conf
2420 root 1232 S grep smbd

bogdan said...

another thing, nmbd is not in the process list, and I did not seen it anywhere in the tutorial...

Anonymous said...

I have a problem with creating a user with smbpasswd command. I get this:

root@router root $ touch /etc/samba/smbpasswd
root@router root $ smbpasswd share share
Could not find user 'share' in /etc/samba/smbpasswd

This is the output of smbpasswd command:

root@router root $ smbpasswd
Usage: smbpasswd [options]

-s read password from stdin
-a add user
-x delete user

if I type

smbpasswd -a share share


smbpasswd -a share

I get

root@router root $ smbpasswd -a share share
Segmentation fault

Can someone halp me? Or show me the example of smbpasswd file for password share


Post a Comment