Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

SMB Slow Logon... Found why, but not how to fix...

Ok. So, SMB works great speed wise for file transfer as our domain's PDC.

Problem is, logon is SLOW!

I did a log dump of the samba file service log file of a single user logon and i found some interesting things.

Essentially, there are 2 logon attempts. The first fails, waits for about 20 seconds, the the second one succeeds. Timing wise, the first one fails within a second, and the second one works with in a second... there is just a stack wait function that makes the user wait for something like 20 seconds.

SO... at a log level 3 debug, I poured through it and found that both authentication methods first identify the user as "unknown" as specified in the smb.conf file, probably because because user credientials haven't been validated yet. Next it identifies the computer by way of the SID. Both authentication methods get this far.

Now, this is the code where something is different between the successful authentication and the unsuccessful one:

- Unsuccessful: nt openpipe: Known pipe NETLOGON opening.
- Successful: nt openpipe: Known pipe lsarpc opening.

From this point, the NETLOGON one essentially does some pushing and poping, frees the pipe, tries "api_rpcTNP: RPC command: NET_AUTH2, the a few lines later does:
setting secctx(0,0) - sec ctx_stackndx = 1
then 20 seconds later
pop secctx(99,99) - sec ctx_stackndx = 0

Now, it redoes everything it had done before (authentcating as guest and checking the SID). Now it says the "lsarpc opening" thing, does the exact same stuff as the NETLOGON method until the line:

api_rpcTNP: RPC command: LSA_OPENPOLICY2
Then it goes on to authenticate the user within a second.

So, moral of the story: it looks like it is using some NETLOGON method, then is using LDAP and the LSA_OPENPOLICY2 associated with 'lsarpc'.

My question: how do i skip the NETLOGON method and/or change the order of authentication here? This would undoubldy fix the problem and authentication would only take 1 second.

I would like to believe this is something in the opendirectorysam auth method, not really in Samba. But, I am not sure.

Keep in mind I am using OS X Server 10.3.9 on a PowerMac G5.

Thank you in advance for your help and I look forward to figuring this one out!

Posted on Aug 18, 2005 10:11 AM

Reply
18 replies

Aug 29, 2005 11:07 AM in response to zandern

Thats what it seems like to me.

However, I have another thread up somewhere about a poll, and I got one response saying the delay is WORSE in 10.4. Furthermore, I have read about a lot of problems involving the PDC in 10.4 and performance in general.

Apple: how do you expect to be a enterprise level competetor when there are serious bugs that have not been addressed in over a year? I love the OS X server architecture, but is this attention to detail that will make me confident in deploying OS X servers in lieu of Windows and Linux boxes.

Please let me know if anyone else has any thoughts.

Thanks!

Sep 14, 2005 6:10 PM in response to zandern

Well, there was some improvement changing sign or seal but not much, I would estimate around 2 seconds. It now takes 13 seconds for a login to succeed on my setup.

I'm using Server 10.4.2 so I have the added bonus of the PDC somehow getting a SIGTERM and shutting down the smbd and nmbd processes.

I guess it's about time to post a bug on Apple's radar.

Sep 15, 2005 11:51 AM in response to Przemek Wozniak

Sorry to hijack your thread, but since I'm experiencing similar problems, here's my smb.conf:

[global]
encrypt passwords = yes
log level = 2
display charset = UTF-8-MAC
security = user
deadtime = 5
guest account = unknown
add machine script = /usr/bin/opendirectorypdbconfig -c create computer
account -r %u -n "/LDAPv3/127.0.0.1"
add user script = /usr/bin/opendirectorypdbconfig -c create useraccount
-r %u -n "/LDAPv3/127.0.0.1"
client ntlmv2 auth = no
preferred master = yes
defer sharing violations = no
winbind separator = +
allow trusted domains = no
netbios name = Example
lanman auth = NO
vfs objects = darwin_acls
wins support = yes
time server = yes
interfaces = en1
brlm = yes
max smbd processes = 0
server string = Mac OS X
logon drive = H:
os level = 64
domain logons = yes
passdb backend = opendirectorysam guest
dos charset = CP437
unix charset = UTF-8-MAC
socket options = TCP_NODELAY IPTOS_LOWDELAY
auth methods = guest opendirectory
local master = yes
domain master = yes
map to guest = Never
use spnego = yes
printer admin = @admin, @staff
logon path = \\%N\profiles\%u
ntlm auth = YES
workgroup = MYWORKGROUP
[netlogon]
path = /etc/netlogon
oplocks = yes
strict locking = no
write list = @admin
browseable = no
[homes]
browseable = no
root preexec = /usr/sbin/inituser %U
create mode = 0750
read only = no
comment = User Home Directories
[Groups]
oplocks = 0
map archive = no
vfs objects = darwin_acls
path = /Groups
read only = no
strict locking = 1
inherit permissions = 0
comment = macosx
create mask = 0644
guest ok = 0
directory mask = 0755
[Public]
oplocks = 0
map archive = no
vfs objects = darwin_acls
path = /Shared Items/Public
read only = no
strict locking = 0
inherit permissions = 0
comment = macosx
create mask = 0644
guest ok = 0
directory mask = 0755
[Users]
oplocks = 0
map archive = no
vfs objects = darwin_acls
path = /Users
read only = no
strict locking = 1
inherit permissions = 0
comment = macosx
create mask = 0644
guest ok = 0
directory mask = 0755
[profiles]
path = /Users/Profiles
oplocks = yes
strict locking = no
read only = no
browseable = no
[printers]
printable = yes
path = /tmp

Sep 15, 2005 6:37 PM in response to Matt Vlasach

OK, here is an idea:

I noticed that the defaults for the smbd configuration in /usr/share/servermgrd/bundles/servermgr smb.bundle/Contents/Resources/servermgr_smbdefaults.plist lists the following order for authorization
<key>auth methods</key>
<string>guest opendirectory</string>

Perhaps things would speed up if we execute

sudo serveradmin settings smb:"auth methods" = "opendirectory guest"

instead of accepting the defaults.

Again, will check in the A.M.

Sep 16, 2005 12:24 PM in response to Etidorhpa

here's mine (it's working without any problems):
workgroup = YOUR DOMAIN_GOESHERE
display charset = UTF-8-MAC
print command = /usr/sbin/PrintServiceAccess printps %p %s
lprm command = /usr/sbin/PrintServiceAccess remove %p %j
security = user
guest account = unknown
encrypt passwords = yes
printing = BSD
allow trusted domains = no
preferred master = yes
lppause command = /usr/sbin/PrintServiceAccess hold %p %j
netbios name = xserve1
wins support = yes
add machine script = /usr/bin/opendirectorypdbconfig -c create computeraccount -r %u -n "/LDAPv3/127.0.0.1"
max smbd processes = 0
printcap =
server string = xserve1
lpresume command = /usr/sbin/PrintServiceAccess release %p %j
logon drive = H:
client ntlmv2 auth = no
domain logons = yes
lpq command = /usr/sbin/PrintServiceAccess jobs %p
admin users = @admin
passdb backend = opendirectorysam guest
dos charset = CP437
unix charset = UTF-8-MAC
auth methods = guest opendirectory
local master = yes
domain master = yes
map to guest = Never
use spnego = no
printer admin = @admin, @staff
logon path = \\%N\profiles\%u
defer sharing violations = no
log level = 1

Sep 16, 2005 8:45 PM in response to Matt Vlasach

According to the Samba documentation, the "auth methods" configuration should always include "guest" as the first method in the list.

I tried my earlier suggestion to reorder the methods to no avail. I've also tried the "sysctl -w net.inet.tcp.delayed_ack=0" trick, which doesn't help for the slow logon.

As a last resort, I stopped the PDC and moved my smb.conf to smb.conf.20050916. Following this I copied the smb.conf.template back to smb.conf and set the Role in Server Admin to PDC. Surpisingly, this temporarily set the server back to a standalone configuration. I changed the the configuration back to PDC again and it took. During the process, I inspected the changes made to smb.conf by Server Admin.

I never had "map to guest = Never" show up with any other configuration changes as far as I can remember.

Anyway, besides setting some of the socket options, limiting the number of users, and changing "use spnego" to "no" via the serveradmin settings smb CLU, these are the new smb.conf settings provided by removing the old configuration file:

[global]
encrypt passwords = yes
workgroup = myworkgroup
display charset = UTF-8-MAC
security = user
deadtime = 5
guest account = unknown
add machine script = /usr/bin/opendirectorypdbconfig -c create computeraccount -r %u -n "/LDAPv3/127.0.0.1"
add user script = /usr/bin/opendirectorypdbconfig -c create useraccount -r %u -n "/LDAPv3/127.0.0.1"
client ntlmv2 auth = no
preferred master = yes
defer sharing violations = no
allow trusted domains = no
netbios name = mynetbiosname
lanman auth = YES
vfs objects = darwin_acls
wins support = yes
brlm = yes
max smbd processes = 20
server string = Mac OS X
logon drive = H:
os level = 20
domain logons = yes
passdb backend = opendirectorysam guest
dos charset = CP437
unix charset = UTF-8-MAC
socket options = TCP_NODELAY IPTOS_LOWDELAY
auth methods = guest opendirectory
local master = yes
domain master = yes
map to guest = Never
use spnego = no
printer admin = @admin, @staff
logon path = \\%N\profiles\%u
ntlm auth = YES
log level = 0

I left out the other sections for brevity. Now I will have to wait until Monday to check whether it has any affect.

Sep 20, 2005 5:49 PM in response to Etidorhpa

Well, login from Win9x machines is now next to instantaneous, although logon and logoff to WinXP machines has slowed considerably. I think the slowdowns may have something to do with ACL's or possibly roaming profiles. There are now errors during the login/logoff stage from XP machines.

Browsing the network shares is better across the board though.

I think the "map to guest" line did the trick for the older computers.

Now, to figure out what the other hold-ups were.

FWIW, this is what I am using to trace the traffic to and from the PDC:
sudo tcpdump -s 255 -vv -l -i en1 port 137 or port 138 or port 139 >sambadump.txt

Make sure the interface matches your hardware.

Sep 20, 2005 11:41 PM in response to zandern

OK. Try this out: http://docs.info.apple.com/article.html?artnum=300257

And if you are allowing guest connections in your smb.conf file (the guest user will be mapped to 'Bad User') try turning that off in the Server Admin. Double check the /etc/smb.conf file once you save your Windows services settings. If the settings took, it should say "map to guest = NEVER".

Last but not least, make sure you followed the procedure for setting your XP boxes for domain login (page 33 of Windows Services 10.4).

Good night, and good luck

Sep 23, 2005 9:52 PM in response to Matt Vlasach

Finally, after much struggling:

Being used to the client version of Mac OS X, I changed the IP of the server without using changeip from the command line first. I followed the directions given in "man changeip" INCLUDING THE HOSTNAME:

changeip /LDAPv3/127.0.0.1 <myOldServerIp> <myNewServerIp> myhostname myhostname

It would not work any other way. In fact, it almost hosed my system the first time I used this script, because I didn't know that it would toy with the input administrator and directory administrator names/passwords so much. To make a long story short, I input my root admin login info, BECAUSE IT ASKS YOU TO PERFORM THIS AS ROOT, and it subsequently changed my root password type to Open Directory (AKKK!). Luckily I had a backup admin account lying around, and a ssh configured to do authentication based on authorized_keys so I could mess up the administrator account and still have some chance of getting everything working again.

In defiance of the manual page, I did not change my network settings before doing the changeip the second time, and it worked!

YMMV (I'm using 10.4.2). Here's my process:
execute the following from the command line from an administrative root account-

sudo -s
<theAdminPassword>
changeip /LDAPv3/127.0.0.1 <myOldIpAddress> <myNewIpAddress> <myHostName> <myHostNameRepeatedAgainBecauseThisScriptWontWorkUnlessIPutAnotherHostNameHere>

you will then be prompted for your admin name and password (on 10.4.2 this is your directory administrative name/password for the OpenDirectory master).

You should see some line confirming that stuff is going to be done

You should see no errors.

When everything is done, assuming the script didn't fail you utterly the way it did me the first time, you should execute:
reboot

And then hopefully everything will be okay your end.

Over and out

SMB Slow Logon... Found why, but not how to fix...

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.