Donate Bitcoins

Running Samba 3.0.23c Under Windows

Using this makefile, and this patch, I successfully compiled Samba under Windows.

Here are the steps to run Samba 3.0.23c under Windows XP Pro SP2. This should also work (but I haven't tested) for any version of Windows, including Windows XP Home, 2000, or 2003:

Samba 3.0.23 on Windows
Ross Smith

Please note in order to get Samba to compile under Cygwin, I had
to remove a build check that reports:

ERROR: No locking available. Running Samba would be unsafe

So please do not assume Samba will actually work under Windows.
Assume it won't.

Instructions to remove Samba are at the end of this file.

To install Samba 3.0.23 in Windows, perform the following steps:

1. Download


2. Unzip to "C:\Progra~1". For example:

   unzip -o -d "C:\Progra~1"

3. Add the following to your system path:


4. Open a Command Prompt window:

   Start / Run / CMD [Enter]

5. Change to the samba directory:

   cd /d C:\Progra~1\samba

6. If Cygwin is installed, skip to step 7. Otherwise, run:

   Go to step 9.
7. If c:\cygwin\bin is in your path, you will need to delete the
   Cygwin dll files in C:\Progra~1\samba\bin, by typing:
   del bin\cyg*.dll
8  Run cygsetup.cmd:


9. Reboot computer:

   shutdown -r -t 0 -c "Let's samba!"

   After rebooting...

10. Open a Command Prompt window:

    Start / Run / CMD [Enter]

11. Run daemons:

    cd /d C:\Progra~1\samba

12. Test Samba locally:

    smbclient -L localhost -U guest%password
    You should see: 
Domain=[hostname] OS=[Unix] Server=[Samba 3.0.23]

        Sharename       Type      Comment
        ---------       ----      -------
        tmp             Disk      /cygdrive/c/windows/temp
        IPC$            IPC       IPC Service (Samba Server)
        Guest           Disk      Home Directories
Domain=[hostname] OS=[Unix] Server=[Samba 3.0.23]

        Server               Comment
        ---------            -------

        Workgroup            Master
        ---------            -------

13. Test Samba from another Windows computer:

    net use * \\\tmp /user:guest password
    Substitute your hostname or ip address for
    You should see:

Drive Z: is now connected to \\\tmp.

14. Change the default passwords:

    smbpasswd guest
    smbpasswd administrator

15. If you add or remove users, you should run the mkpasswds.cmd command:

    cd /d C:\Progra~1\samba

To remove Samba, do the following:

1. Kill the smbd and nmbd processes (by rebooting if you want)

2. Remove the following from your system PATH:

3. Open a Command Prompt window:

   Start / Run / CMD [Enter]

4. Change to the samba directory:

   cd /d C:\Progra~1\samba

5. Run the following:

   regedit /s enablenetbios.reg
   cd ..
   rmdir /s /q samba

   shutdown -r -t 0 -c "No more samba :("

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

How to allow user delete the file

Hi all,

I got it running on Windows XP SP3, everything run smoothly except the user can not delete his/her own files. In windows XP security folder permission, I did allowed user have full permission but he/she able to create/edit/save BUT CAN NOT DELETE FILE. How can I make that work? Here is sample of my configuration:

[SHARE Scanner]
comment = SHARE Scanner
path = /cygdrive/c/docume~1/admini~1/desktop/SHAREs~1
public = no
valid users = Mike
Writable = yes
; readonly = no
create mask = 0777
; only guest = yes
guest only = yes


Domain controler

I have modified de smb.conf file to work as domain controler I restarted the pc, and when I try the installation I revice
C:\PROGRA~1\samba>smbclient -L localhost -U guest%password
session setup failed: NT_STATUS_LOGON_FAILURE

Any idea? THANKS !!!



as the title says it work with xp sp3, but i have few problems , maybe am missing few things , which is some commands doesnt work at all, like restarting the samba or any service on it ..

adding users, few status command, etc ... will am having alot of hard time figuring those out , would anyone tell me whats the problem


some users who had problems with 10 clients limitations ..

heres the solution .. for SP3 , and it will work on SP2

works like GOLD :P


please someone help me with my stupid problem !




as the title says it work with xp sp3, but i have few problems , maybe am missing few things , which is some commands doesnt work at all, like restarting the samba or any service on it ..

adding users ... will am having alot of hard time figuring these out , would anyone tell me whats the problem


Mapping from a Windows ME terminal

Well, I managed to complete everything in this tutorial: setup a SAMBA at 1 winXP PC, with a custom folder shared. Meanwhile all 31 winXP terminals in office already mapped successfully.


leaving 1 last PC which is running Windows ME...

The mapping command with /user:xxxxxxxx is not supported. A message prompt indicated that: The option "USER:xxxxx" is unknown. Make sure you are specifying a valid option, and then try again."

Any clue?

Try the NET LOGON command mentions the

net logon

command, so try this:

net logon user password
net use Z: \\host\share

hi newbee here, is there a

hi newbee here, is there a way to set samba without user:password? thanks ross

deleting .dll files

I thought I deleted all cyg*.dll files from the samba folder (since I already have cygwin) and when I search for them nothing comes up--but then in /samba/sbin when I ls all the files, I see cygcrypt-0.dll and cygwin1.dll (even though they're invisible when I open that folder manually). So I tried deleting those files and it says

rm: cannot remove `cygcrypt-0.dll': Permission denied
rm: cannot remove `cygwin1.dll': Permission denied

Also when I try to do

$ smbclient -L localhost -U guest%password

I get:

bash: smbclient: command not found

...but maybe this has something to do with the presence of those .dll files?

Thanks for the help!

hmm OK sorry you can ignore

hmm OK sorry you can ignore that last post.

Running Samba 3.0.23c Under Windows

I was just wandering does this work now as a fully functioning samba system.
I download the files and installed as per your instruction above. Everyting worked
as stated with no problems. I installed it on a Windows 2003 Standard Server
with AD. Is there a way to configure more shares and users with this version?


File and Print Client...

Perhaps I am slow, but it took me a while to figure out that you have to also disable the microsoft client. This makes accessing shares via the direct \\device impossible. After playing with it quite some time I was unable to find a work around. I believe I see the reason for it. I think the client and server both keep those 139/445 ports open. So I understand that you have to totally kill the workstation service as well. Is it perhaps possible to move the workstation service or samba service to a different port so that the two can co-exist.

Problem with Network Drives

Hi. Newbee here. I went through these directions word for word worked perfectly. But it clobbered my mapped drives. In fact I can't browse to any network shares in Windows. I've followed the remove samba procedure, but even after restart, my mapped drives are no more ! please help! Do I have to uninstall and reinstall Windows...(again?)

where are Administrator and guest accounts defined?


I would like to create extra users e.g. johnsmith to go to the /samba/etc/passwd and group files but when I do that and try to use smbpasswd to set the password I get error message. Can you tell me how come Administrator and guest don't give me the error message and is there a way I can create a new user using your samba setup that i can set the password with smbpasswd?

If I can't do that, can someone give me point point guide on how to do it with cygwin so it links to samba

any help is greatly appreciated



samba as domain controller

Has anyone tried to run this samba version as domain controller? It would be nice alternative for small companies and has benefit to not pay for the linux guys extra... you can find many peaople who can handle windows, put few who are home in linux. Next step wold be little gui :)

But keep up the good work.. :) I really like to use alternatives.

about samba performance

to start with this comment, i fully understand that this is not officially supported and simply a method to prove that it can work with Cygwin under windows and not meant for production use.

Firstly i have done some real world tests on a server with RAID-5 array and it seems like with samba conf optimizations, the 'emulated' samba cannot really perform and file copy to windows/mac clients are very slow.

On a 100mbit network, default windows share on this server could achieve 8-9mbyte/s in realtime across a mac or windows machine.

Samba/cygwin can achieve 2-2.5mbytes/sec at best meaning around 20-30mbps.

Is there anyway to give more 'raw power' or to tweak samba settings to make it fully utilize memory or cache to speed up the file copy speed?

by the way can i engage you as a consultant for this particular issue as you have proved that this solution is viable and i'm really interested in this.



My guess is that one could approach native Windows performance, by hacking the samba code to use native Windows API calls, instead of the emulated *nix functions.

Also, you could do the same with the missing "locking" code, so this could be used in a production environment.

I'm happy to help if I can, but I can't take on any new clients at this time, but thank you for the request. Perhaps in the future.

Change Drive/Folder

> Bah, nevermind. Just after I posted this I found a config file (C:\Program Files\samba\lib\smb.conf)


Does any one know how to change the default tmp folder to point to another drive or folder ?

Change this:
tmp Disk /cygdrive/c/windows/temp

to say this:
tmp Disk /cygdrive/d/

I've tried to look for a configuration file but can't find one.



File permissions

Samba works great on a Windows XP SP2 - I got 10-15 Windows clients each of which has at least two network drives connected. Performance seems to be the same as with Windows' proprietary services - Plus it is possible to have more than ten clients (which is the hard-wired maximum of XP)!
However I got a small but nasty problem, that might be linked to the way file permissions are set by smbd.exe:
Some Windows progs cannot save files on the network drives (E.g.: Word throws an error, claiming that too many files are open...)
I suspect that the cause for this might be, that smbd creates files with "read" and "write" permissions but not with the permission "change" etc. Also files are created with the group rights of "Nobody". Even if add the group "Everybody" with all the rights to be inherited from a folder above, the newly created files do not have all the permissions for "Everybody".
Does anyone have a solution for this? I tried changing the group id of some of the users in samba\etc\passwd, but files are still created as "Nobody". Adding "force create mask = 0777" to samba\lib\smb.conf did not do anything either.

Could the workflow I am using to create samba users be wrong?:
First I add a windows user, then I call samba\mkpasswds.cmd, afterwards I manually add the new user to samba\private\smbpasswd by copying and changing one of the above lines (this is not done automatically on my machine), and finally I use smbpasswd to set the users password.


Well, I just wanted to inform everybody that this is not urgent for me any more...
I "solved" the problem by installing a virtual machine with linux in it :-)
Still - If anyone has a solution, that would be interesting!

this seemed like just what I needed

Hi I was to say atleast very happy when I got a hit on this when searching for something to allow a non domainserver to easy share with user:password ability under windows in a nice way.. I'm pretty used with samba running it under linux so this was great I thought..

sad thing is I have tried and tried to get this to work unt il I started to realease that U also had hardcoded the path in binaries to C:\progra~1\ ... and so on.

this cause a big problem for non english windows..

I'm using a swedish windows XP and default program path is C:\program\
which makes it impossible to go around even thou I make a path like C:\program(something)
I guess it hits the swedish default path first and goes along with that.. Which to me make no reason bcs that should work fine.. shouldnt it ?

also wanna add that I done evevrything by the book here after ur example.

or am I missing something here ?

I'm not a windows expert so I could be considered a noob here :P

so I desperatly hoping for some smart answers here :)

might aswell add some error output to make it easier..

C:\Program\samba\bin>smbclient -L
params.c:OpenConfFile() - Unable to open configuration file "C:/PROGRA~1/samba/l
No such file or directory

Load smb config files from C:/PROGRA~1/samba/lib/smb.conf
params.c:OpenConfFile() - Unable to open configuration file "C:/PROGRA~1/samba/l
No such file or directory
map_file: Failed to load C:/PROGRA~1/samba/lib/valid.dat - No such file or direc
creating default valid table
Error loading services.

I also noticed that 1 of the reason might be that the service dont even start when running start_daemons.cmd.. have also tried to add the path by running path command with C:\progra~1\samba\lib without any luck

I *had* to hard code something

as Samba requires it. Perhaps you can change the short file name of your %ProgramFiles% by using SetSFN. Please let me know if that works for you or not.

I have tried the SETSFN

I have tried the SETSFN command and I get acccess denied when trying to change it, also it reports the current SFN of %programfiles% as program (pointing to C:\program)

I tried this as the "root" administrator account.

Any ideas ? I really wanna get this to work :P

Why don't you just create a directory named c:\Progra~1


mkdir c:\Progra~1

Then unzip into this folder, so you end up with a directory named:



I did got it to work better

I did got it to work better but I dont get the smbd proc to run and getting the same problem as below and nothing is listening on the ports..

I tried reinstall it several tiems just dont get it to work.. no firewall all service thinkable that could be needed is running

Didn't find any thing on

Didn't find any thing on port 445 and 139!

and yes, i have Norton Firewall! What do I do?

Problem Testing

Ross, I'm getting an error when I try to test the SAMBA localy! This is what I get:

C:\Program Files\samba>smbclient -L localhost -U guest%password
timeout connecting to
timeout connecting to
Error connecting to (Operation now in progress)
Connection to localhost failed

The installation worked fine! Do you know how to fix it?


question, please help

Dear Thiago,

I like to ask you if could you fix that problem what you mention in 12/18/2006 - 08:53 at this page:

I get the same message :

Microsoft Windows XP [verziószám: 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Program Files\samba>start_daemons.cmd

C:\Program Files\samba>"C:\Program Files\samba\sbin\nmbd.exe" --daemon

C:\Program Files\samba>"C:\Program Files\samba\sbin\smbd.exe" --daemon

C:\Program Files\samba>smbclient -L localhost -U guest%password
timeout connecting to
timeout connecting to
Error connecting to (Operation now in progress)
Connection to localhost failed

So, can you help me?

Thank you. Laci

Try netstat

Type this:

netstat -an

and see if anything is listening locally on ports 445 and 139.

If not, then the installation was not successful.

Do you have any sort of firewall running?


Tune up!?

Everything works fine. Thank you very much for this port. Now I have some questions. :)

1. Is it possible somehow to access and use other windows pc’s shares and map them as network drives on the box with windows+samba?

2. Is it possible to “clean up” non-BartPE installation?

2.1 I’m talking about z_samba .html, .ini and .xml files in the root, .bat and .reg files in the files directory. I found no use of these files during installation. Do I need these files for samba to operate or can I safely delete them?

2.2. Is it necessary to map all those z: and y: drives to samba directories?

3. Is where any way to stop/restart nmbd and smbd beside killing them with Task Manager? This will be nice for smb.conf troubleshooting.

4. Is it possible without loosing functionality to serviceze smbd and nmbd with srvany or serviceex?

Thank you!


1. Good question. Never tried. Did you try to use the "net use" command?

2.1 You can safely delete.

2.2. For this port, yes. Those drives are hard coded in the samba binaries, as I couldn't figure out how to specify relative directories.

3. You could try using Cygwin's kill command to send a signal to those processes. See the Samba documentation for details.

4. Yes, I'm sure that's possible, but I would try Cygwin's cygrunsrv first, as it works well with other ported *nix daemon's, such as cron, exim, inet-d, rsync, ssh, etc.

Good luck, and please report back on your progress.

Report 2

2.2. One more argument for hard coding not only the only one path, but options (--configfile=./smb.conf --log-basename=./logs --hosts=./lmhosts) too, until relative directories will work. I see no need to change them..But now it’s important for servicezing, see 4.

4. I’ve tried srvany, serviceex and cygrunsrv with no luck, even specifying application work directories differed from application location.. In all cases reported problem about paths. I think it’s all about options string for daemons.

Ross, can you recompile apps with hard coded single path "%SystemDrive%\Progra~1\samba\" and options “--configfile=./smb.conf --log-basename=./logs --hosts=./lmhosts” or something like this?

Report 1

After some tests...

2.2 Yep, it better to hardcode the one and only, not substituted drive. Services won't start automatically at boot, because substitutions are made after services start. And nmbd and smbd should be started in Y:\samba because of configs, and smbd and nmbd are in Z:\samba. Not sure by now, but it could be a problem for service to start.

5. As for this list:

cygcrypt-0 .dll
cygiconv-2 .dll
cyglber-2-2-7 .dll
cygldap-2-2-7 .dll
cygminires .dll
cygncurses-8 .dll
cygreadline6 .dll
cygsasl2-2 .dll
cygssl-0.9.7 .dll
cygwin1 .dll

It seems that it isn't full. With this files only nmbd starts, but smbd not. So it's possible, but need improvements.


1. Yep, I've tried "net use" with "System error 67 has occurred. The network name cannot be found" output. Itâ's normal, all the netbios services disabled. So the question now is:

1.2 Maybe some of the services could be left running? Or...

1.3 I thought about some kind of win32 app, that can access smb shares by itself, not using the system services. Maybe a combination of "cmd+Microsoft network client for DOS+FAR manager" will do the job. Any other suggestions?

2.2 Is it possible to hardcode all the paths for one drive and installation directory, let's say "c:\samba" or even better "%SystemDrive%\Progra~1\samba\"?

3 and 4. By now I don't plan to use other nix stuff on that pc, so I don't want to use full cygwin at all, nor to control daemons or serviceze samba. If the srvany or serviceex will work fine, the service stop/start/restart won't be a problem: "net stop|start smbdsrv|nmbdsrv". I'll try this.

5. And there is one more test ahead: cygwin minimization down to your list posted above. Any successful reports?

Thank you!

Tested and works for me under XP SP2

Re your post:

1: I couldn't get net use to work either. If you figure out how, please let me know.

1.2: I could start up the Workstation and Server services, but net use still didn't work.

1.3: That's certainly a possibility. I'm not sure why you want to do this though. Can't you just run subst to achieve the same effect?

2.2: Done.

3 and 4: Again, certainly doable.

5: The zip file contains the required Cygwin files, so you don't need to have Cygwin installed, as before.

Good luck!

Help please

Hello, I would be very grateful if you could assist me, i am currently trying to impliment samba on windows for a university project however everything seems to fail currently i have the following questions:

1- Is wget needed to get the z-samba file? i have just downloaded it straight from the net using basic right-click save method. Would downloading it using wget make a difference?

2- I have downloaded the full Cygwin package by selecting the 'install' option with regards to all the different cygwin packages in the installation menu, is that all thats needed? a previous poster mentioned that i needed opendlap-2-2-7, isnt that automatically installed if i installed the full cygwin package? if not how do i activate it since currently nothing saves to smbpassword.

3- For the samba bin folder i have copied the 'bin' folder and pasted it under System 32, System and Windows folder is this correct?

4- can i see a sample smb.conf file that would work if im implimenting the solution in a basic windows setup and based on above set of instructions posted by Ross since im finding it difficult to edit the samba.conf file to comply with Windows, this would be appreciated.

5- I keep getting error messages when trying to use the 'net send' option, it doesnt seem to find the machine although i can ping successfully between two machines

6- How can i use other system commands other that smbpasswd -a username, for example is there a way to use all the samba command such as those to add a new computer etc etc?

7- Is there a way once samba is successfully working to view the shared folder using something like windows explorer instead of using command prompt - net send each time as i would like to be able to see the shared folder from linux or windows directories.

8- Final question, when you say to download the 'additional packages' wget and unzip, where do i download them from? so far ive been renaming and moving the z_samba file manually as opposed to using command prompt.

Thanks alot, i know its quite a few questions but i hope someone can help me

Not sure if this will help you....

1. No. That was just an example, to point out that the file downloads fine.

2. OpenLDAP is only needed if you want that functionality. Samba doesn't require LDAP.

3. No. Not sure why you are doing this. Instead, add the bin directory to your PATH.

4. contains z_samba/files/ramdrv/samba/smb.conf, which has already been configured to work with Windows.

5. Not all programs may work. If something doesn't work, try the Windows equivalent, and see if it works.

6. Need specfic details, sorry.

7. I have successfully used Windows Explorer to "see" a share served by Samba running under Windows.

8. From within the Cygwin setup program.

Are you installing Samba under BartPE, or Windows? Which version of Windows, specifically? If BartPE, it should work out of the box. If not, please include a detailed error report, including the output of the B:\cygwin\var\log\smbd.log files (I think that's what they are named).

If Windows, then please follow the instructions at and include a detailed error report if you have any issues.

Good luck,

I was installing it under Win

I was installing it under Windows Xp Sp1, I had followed the instructions and whilst i had managed to successfully add users using the smbpassword command i still couldnt access the samba machine from another networked computer running windows 2003 using the 'net use' command since it couldnt find the Samba computer.

However before i delve deeper using this method i think il try using BartPE first and add the plugin for samba and see if it works this time. Im not to familiar with using BartPE am i correct in assuming that i just have to download the relative plugins i.e, and and their associated .inf files and add them to the prebuilder plugin list? Would i need the .mak file and the .patch file?

Once ive got my BartPE Windows CD and installed it onto a computer when you say that samba should 'work out of the box' does that mean i would proceed straight to steps 13 & 14 on this page:
in order to add users and start Samba or would i have to follow the list from step 1 onwards?

And finally would i have to install the Cygwin package on a BartPE computer to run Samba or is the plugin sufficient?

Thanks again, I greatly appreciate this, i would really like to get Samba working on Windows.

Installing Cygwin is required


You need to actually install Cygwin on the box you are creating your BartPE disk on. Then, follow the instructions in each of the .html files that accompanies each plugin. This is true of all BartPE plugins.

If you are installing Samba in BartPE, then the instructions at do not apply.

Good luck,


Thanks alot for your help Ros

Thanks alot for your help Ross, i have successfully managed to get samba working under Windows xp based on your instructions, the problem appeared to be with using windows 2003 as a client which didnt work, as soon as i installed windows xp on the second machine it worked!!!

With regards to my question on samba commands, what i wanted to know was whether it was possible to add a machine or a user using cygwin/samba since on linux/samba i would use the command 'adduser' and 'smbpasswd -a -m name' for adding a machine whereas both commands do not work here.

Also is there a way for me to set up my samba as a domain controller? basically when i got to System - Computer name and try to change the domain name + workgroup to the one in the samba config file it successfully shows the username/password prompt which would usually be root + password but this does not work here.

Very Grateful and happy!!


Please post your results


I can't answer your questions as I haven't used Samba in the way you are attempting to use it.

If you are able to use it as a domain controller, please post your results here. I, and others, would appreciate it.

Good luck,


When installing cygwin

Don't forget to also install the package opendlap-2-2-7, otherwise you can't run the Samba deamon, nor add users.

Unable to access the

Need a little help accessing the file located at, keep getting permission denied. I would really like to try implementing this solution. Thanks in advance.


Works for me, with Firefox, and wget

Not sure what the problem is, as it's working fine for me:

$ wget -S
           => `'
Connecting to||:80... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Sat, 11 Feb 2006 00:14:44 GMT
  Server: Apache
  Last-Modified: Wed, 13 Jul 2005 03:44:40 GMT
  ETag: "6e0349-6deac0-42d48e28"
  Accept-Ranges: bytes
  Content-Length: 7203520
  Keep-Alive: timeout=15, max=100
  Connection: Keep-Alive
  Content-Type: application/zip
Length: 7,203,520 (6.9M) [application/zip]

100%[====================================>] 7,203,520    683.95K/s    ETA 00:00

16:14:53 (655.44 KB/s) - `' saved [7203520/7203520]

Cannot download

Keep getting permission problems. Used to be able to download using firefox/IE fine about a month ago.

Error message that comes up in firefox is:

You don't have permission to access /files/plugins/ on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Fixed, sorry for the inconvenience

My new 'one click' compile/sign/publish script had rsync changing the permissions. I've fixed the script so this shouldn't happen. Sorry for the inconvenience.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Donate Bitcoins
Special thanks to Riester Rente Online for a generous donation!