<?xml version="1.0" encoding="utf-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Fun with ones and zeros - samba</title>
<subtitle>Barry&#039;s notes on computer software and hardware</subtitle>
<link href="/blog/tags/samba"></link>
<updated>2026-05-07T09:25:55-07:00</updated>
<id>urn:uuid:dd754306-652f-b09b-b39a-afcf611012b6</id>
<entry>
<title>Winbind failure do to incorrect time</title>
<link href="/blog/entries/winbind-failure"></link>
<id>urn:uuid:4accc925-c421-25c5-9e18-0ed7c06a12ba</id>
<updated>2015-07-08T09:51:00-07:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">&lt;p&gt;I had the weirdest thing suddenly start happening last night that took several hours to finally figure out was a time-related issue.&lt;/p&gt;
&lt;p&gt;I&#039;ve got an Ubuntu box that uses &lt;code&gt;pam_winbind&lt;/code&gt; to allow for logging into a machine using an Active Directory account.&lt;br /&gt;
Normally I connect with an SSH key, but once in when doing &lt;code&gt;sudo -s&lt;/code&gt; I enter an AD password to become root.  Last night
that &lt;code&gt;sudo -s&lt;/code&gt; suddenly stopped working.  &lt;/p&gt;
&lt;p&gt;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:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;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]&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;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&#039;t locked out.  &lt;/p&gt;
&lt;p&gt;I hoped by the next morning, some cache thing would expire and I&#039;d be back in business, but no dice.  &lt;/p&gt;
&lt;p&gt;Poking around some more I found if I disabled my SSH keys, I couldn&#039;t log in at all, so it was really a &lt;code&gt;pam_winbind&lt;/code&gt; issue, not  a &lt;code&gt;sudo&lt;/code&gt; one.  The logs for a SSH password login attempt were a bit more informative:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;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 &#039;barry.pederson&#039; denied access (incorrect password or invalid membership)
Failed password for barry.pederson from x.x.x.x port 50655 ssh2&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;WTF?  I know the password&#039;s right, I&#039;ve been typing it all morning into other systems.  I even tried &lt;code&gt;wbinfo --authenticate barry.pederson&lt;/code&gt; on this box and it accepted my passwords.&lt;/p&gt;
&lt;p&gt;Much time was spent Googling, trying various tweaks to &lt;code&gt;smb.conf&lt;/code&gt;, etc.  Finally, I don&#039;t remember why, I thought to check the date with &lt;code&gt;ntpdate -d my.ad.server&lt;/code&gt; and it came back with &lt;code&gt;offset -338.308573 sec&lt;/code&gt;.  Holy crap, that&#039;s more than 5 minutes!  Even though ntpd is running.  &lt;/p&gt;
&lt;p&gt;Anyhow, once the clock was fixed to be closer to the AD server, logins and sudo started working again.&lt;/p&gt;</content>
</entry>
<entry>
<title>smbpasswd 1.0.2 submitted to PyPi</title>
<link href="/blog/entries/smbpasswd-submitted-pypi"></link>
<id>urn:uuid:9ef72a88-b8b2-3ed7-d77b-41f6879210b1</id>
<updated>2011-07-17T12:36:00-07:00</updated>
<author><name>Barry Pederson</name>
<email>bp@barryp.org</email>
</author>
<content type="html">&lt;p&gt;smbpasswd is a really old piece of software (9 years!) for generating NT/LM password hashes, suitable for use with Samba.  It&#039;s in Debian/Ubuntu/Redhat repositories, and FreeBSD ports, and who knows where else.  &lt;/p&gt;
&lt;p&gt;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 &lt;a href=&quot;http://pypi.python.org/pypi/smbpasswd&quot;&gt;smbpasswd-1.0.2&lt;/a&gt;, or just &lt;code&gt;easy_install smbpasswd&lt;/code&gt; if you&#039;re setup for that.&lt;/p&gt;
&lt;p&gt;I changed the packaging slightly, so that the tarball extracts to &lt;code&gt;smbpasswd-x.x.x&lt;/code&gt; instead of &lt;code&gt;py-smbpasswd-x.x.x&lt;/code&gt;, and so bumped the version number to 1.0.2 just for the packaging changes.   The library itself is unchanged.&lt;/p&gt;
&lt;p&gt;However, I think you&#039;d want to be very careful generating and storing LM hashes of user&#039;s passwords, they seem to be &lt;a href=&quot;http://en.wikipedia.org/wiki/LM_hash#Security_weaknesses&quot;&gt;wildly insecure&lt;/a&gt;.  &lt;/p&gt;
&lt;p&gt;If your app can get by with just NT hashes, and you have a Python &amp;gt;= 2.5, you may be able to generate those using the standard Python library, and don&#039;t need this package at all.  See the notes on my &lt;a href=&quot;/software/py-md4&quot;&gt;py-md4&lt;/a&gt; page.&lt;/p&gt;</content>
</entry>
</feed>