<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0">
<channel>
<title>Fun with ones and zeros - samba</title>
<description><![CDATA[Barry's notes on computer software and hardware]]></description>
<link>/blog/tags/samba</link>
<lastBuildDate>Thu, 07 May 2026 09:23:23 -0700</lastBuildDate>
<item>
<title>Winbind failure do to incorrect time</title>
<link>/blog/entries/winbind-failure</link>
<pubDate>Wed, 08 Jul 2015 09:51:00 -0700</pubDate>
<author>bp@barryp.org (Barry Pederson)</author>
<description><![CDATA[<p>I had the weirdest thing suddenly start happening last night that took several hours to finally figure out was a time-related issue.</p>
<p>I've got an Ubuntu box that uses <code>pam_winbind</code> to allow for logging into a machine using an Active Directory account.<br />
Normally I connect with an SSH key, but once in when doing <code>sudo -s</code> I enter an AD password to become root.  Last night
that <code>sudo -s</code> suddenly stopped working.  </p>
<p>Luckily I had another non-AD account that I could connect with, and sudo worked for that, so I could become root and poke around.  The logs showed:</p>
<pre><code>sudo: pam_unix(sudo:auth): authentication failure; logname=barry.pederson uid=14283 euid=0 tty=/dev/pts/0 ruser=barry.pederson rhost=  user=barry.pederson
sudo: pam_unix(sudo:auth): conversation failed
sudo: pam_unix(sudo:auth): auth could not identify password for [barry.pederson]</code></pre>
<p>That was weird, I could log into other things though that used the same AD account, so I knew the password was right and the account wasn't locked out.  </p>
<p>I hoped by the next morning, some cache thing would expire and I'd be back in business, but no dice.  </p>
<p>Poking around some more I found if I disabled my SSH keys, I couldn't log in at all, so it was really a <code>pam_winbind</code> issue, not  a <code>sudo</code> one.  The logs for a SSH password login attempt were a bit more informative:</p>
<pre><code>pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxx.yyy.zzz  user=barry.pederson
pam_winbind(sshd:auth): getting password (0x00000388)
pam_winbind(sshd:auth): pam_get_item returned a password
pam_winbind(sshd:auth): request wbcLogonUser failed: WBC_ERR_AUTH_ERROR, PAM error: PAM_AUTH_ERR (7), NTSTATUS: NT_STATUS_LOGON_FAILURE, Error message was: Logon failure
pam_winbind(sshd:auth): user 'barry.pederson' denied access (incorrect password or invalid membership)
Failed password for barry.pederson from x.x.x.x port 50655 ssh2</code></pre>
<p>WTF?  I know the password's right, I've been typing it all morning into other systems.  I even tried <code>wbinfo --authenticate barry.pederson</code> on this box and it accepted my passwords.</p>
<p>Much time was spent Googling, trying various tweaks to <code>smb.conf</code>, etc.  Finally, I don't remember why, I thought to check the date with <code>ntpdate -d my.ad.server</code> and it came back with <code>offset -338.308573 sec</code>.  Holy crap, that's more than 5 minutes!  Even though ntpd is running.  </p>
<p>Anyhow, once the clock was fixed to be closer to the AD server, logins and sudo started working again.</p>]]></description>
</item>
<item>
<title>smbpasswd 1.0.2 submitted to PyPi</title>
<link>/blog/entries/smbpasswd-submitted-pypi</link>
<pubDate>Sun, 17 Jul 2011 12:36:00 -0700</pubDate>
<author>bp@barryp.org (Barry Pederson)</author>
<description><![CDATA[<p>smbpasswd is a really old piece of software (9 years!) for generating NT/LM password hashes, suitable for use with Samba.  It's in Debian/Ubuntu/Redhat repositories, and FreeBSD ports, and who knows where else.  </p>
<p>Somehow it never got submitted to PyPi, but I took care of that today at the request of someone working on another Python module that wanted to use this as a dependency.  Look for <a href="http://pypi.python.org/pypi/smbpasswd">smbpasswd-1.0.2</a>, or just <code>easy_install smbpasswd</code> if you're setup for that.</p>
<p>I changed the packaging slightly, so that the tarball extracts to <code>smbpasswd-x.x.x</code> instead of <code>py-smbpasswd-x.x.x</code>, and so bumped the version number to 1.0.2 just for the packaging changes.   The library itself is unchanged.</p>
<p>However, I think you'd want to be very careful generating and storing LM hashes of user's passwords, they seem to be <a href="http://en.wikipedia.org/wiki/LM_hash#Security_weaknesses">wildly insecure</a>.  </p>
<p>If your app can get by with just NT hashes, and you have a Python &gt;= 2.5, you may be able to generate those using the standard Python library, and don't need this package at all.  See the notes on my <a href="/software/py-md4">py-md4</a> page.</p>]]></description>
</item>
</channel>
</rss>