<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SurlyJake &#187; Samba</title>
	<atom:link href="http://www.surlyjake.com/category/linux/samba/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.surlyjake.com</link>
	<description></description>
	<lastBuildDate>Fri, 30 Dec 2011 15:28:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Prevent samba from creating home directory for machine accounts.</title>
		<link>http://www.surlyjake.com/2011/08/prevent-samba-from-creating-home-directory-for-machine-accounts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=prevent-samba-from-creating-home-directory-for-machine-accounts</link>
		<comments>http://www.surlyjake.com/2011/08/prevent-samba-from-creating-home-directory-for-machine-accounts/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 22:34:29 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.surlyjake.com/?p=367</guid>
		<description><![CDATA[Since this setup automatically creates a home directory for a user as soon as they access the machine (via samba, ssh, console), I noticed some directories being created for computer accounts.  To prevent this,  I have added a line that only &#8220;Domain Users&#8221; are allowed to authenticate.  To add this: wbinfo -n "Domain Users" It [...]]]></description>
			<content:encoded><![CDATA[<p>Since this setup automatically creates a home directory for a user as soon as they access the machine (via <a href="http://www.surlyjake.com/tag/samba/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Samba">samba</a>, ssh, console), I noticed some directories being created for computer accounts.  To prevent this,  I have added a line that only &#8220;Domain Users&#8221; are allowed to authenticate.  To add this:</p>
<pre><code>wbinfo -n "Domain Users"</code></pre>
<p>It will spit out the SID for the Domain Users group. Something like this:</p>
<pre><code>S-1-5-21-((some number))-((some number))-((some number)) Domain Group (2)</code></pre>
<p>Take that number and change the Pam_<a href="http://www.surlyjake.com/tag/winbind/" class="st_tag internal_tag" rel="tag" title="Posts tagged with winbind">winbind</a>.so line in /etc/pam.d/common-session to look like this:</p>
<pre><code>session sufficient pam_winbind.so require_membership_of=S-1-5-21-((some number))-((some number))-((some number)</code></pre>
<div class="none"><div class="g-plusone" data-href="http://www.surlyjake.com/2011/08/prevent-samba-from-creating-home-directory-for-machine-accounts/" size="standard" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.surlyjake.com/2011/08/prevent-samba-from-creating-home-directory-for-machine-accounts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Group share for a Active Directory domain group with Samba</title>
		<link>http://www.surlyjake.com/2009/05/create-a-group-share-for-a-domain-group-with-samba/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=create-a-group-share-for-a-domain-group-with-samba</link>
		<comments>http://www.surlyjake.com/2009/05/create-a-group-share-for-a-domain-group-with-samba/#comments</comments>
		<pubDate>Wed, 06 May 2009 20:38:36 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Debian Lenny]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[share]]></category>

		<guid isPermaLink="false">http://www.surlyjake.com/?p=370</guid>
		<description><![CDATA[Once you have joined your samba server to your domain and have set up user authentication, creating a share that will allow a group of users to access files is pretty simple.  We need to create a folder that is owned by the root user and the domain group. The samba share will inherit permissions [...]]]></description>
			<content:encoded><![CDATA[<p>Once you have joined your <a href="http://www.surlyjake.com/tag/samba/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Samba">samba</a> server to your domain and have set up user authentication, creating a <a href="http://www.surlyjake.com/tag/share/" class="st_tag internal_tag" rel="tag" title="Posts tagged with share">share</a> that will allow a group of users to access files is pretty simple.  We need to create a folder that is owned by the root user and the domain group. The <a href="http://www.surlyjake.com/tag/samba/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Samba">samba</a> share will inherit permissions from the parent folder.  Here is an example for creating a folder for a domain group called &#8220;corporate_HR&#8221;. The domain is called &#8220;acme&#8221;. There is administrative support group called &#8220;admins&#8221;. Setting the folder&#8217;s permissions to &#8220;2771&#8243; means that the owner (root) and the group (corporate_HR) have full access.  The &#8220;2&#8243; is a setgid bit. It will force all new files created under the HR folder to take the group parameter from it&#8217;s parent.  We use the &#8220;force group&#8221; parameter to ensure that permissions are set properly when a member of the &#8220;ACME\admins&#8221; group accesses the files.</p>
<p>login as root.</p>
<p>to set up the filesystem:</p>
<pre><code>cd /home
mkdir HR
chgrp corporate_HR HR
chmod 2771 HR</code></pre>
<p>set up the share:</p>
<pre><code>[HR]
comment    =    share for corporate HR group
readonly    =   no
inherrit owner    =    yes
inherit permissions    =    yes
authorized users    =    @ACME\corporate_HR @ACME\admins
force group    =    ACME\corporate_HR</code></pre>
<div class="none"><div class="g-plusone" data-href="http://www.surlyjake.com/2009/05/create-a-group-share-for-a-domain-group-with-samba/" size="standard" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.surlyjake.com/2009/05/create-a-group-share-for-a-domain-group-with-samba/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Join Debian Lenny to Active Directory using Samba</title>
		<link>http://www.surlyjake.com/2009/05/join-debian-lenny-to-active-directory-using-samba/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=join-debian-lenny-to-active-directory-using-samba</link>
		<comments>http://www.surlyjake.com/2009/05/join-debian-lenny-to-active-directory-using-samba/#comments</comments>
		<pubDate>Fri, 01 May 2009 20:48:45 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Debian Lenny]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[winbind]]></category>

		<guid isPermaLink="false">http://www.surlyjake.com/?p=338</guid>
		<description><![CDATA[If you install GNOME on Debian and intend to use it as a server, first thing you should do is remove the network-manager and network-manager-gnome packages. This tool can be helpful on a desktop, but since we are tweaking DNS, IP addresses, and perhaps even NIC bonding, the network-manager can screw up your settings. aptitude [...]]]></description>
			<content:encoded><![CDATA[<p>If you install GNOME on <a href="http://www.surlyjake.com/tag/debian/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Debian">Debian</a> and intend to use it as a server, first thing you should do is remove the network-manager and network-manager-gnome packages. This tool can be helpful on a desktop, but since we are tweaking DNS, IP addresses, and perhaps even NIC bonding, the network-manager can screw up your settings.</p>
<pre><code>aptitude purge network-manager-gnome network-manager </code></pre>
<p>If this is a VMware Virtual machine, install VMware tools. The prerequisites for Debian <a href="http://www.surlyjake.com/tag/lenny/" class="st_tag internal_tag" rel="tag" title="Posts tagged with lenny">Lenny</a> are:</p>
<pre><code>aptitude install build-essential openssl libssl-dev <a href="http://www.surlyjake.com/tag/linux/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Linux">linux</a>-headers-$(uname -r) psmiscapt</code></pre>
<p>You may have to manually create a DNS entry for your server. Just to be safe, do that now.</p>
<p>If you plan to support NTFS-like ACL&#8217;s, install support for it now.</p>
<pre><code>aptitude install acl</code></pre>
<p>now, you need to mount the partition with ACL&#8217;s enabled, to do this, edit your /etc/fstab.</p>
<pre><code>nano /etc/fstab</code></pre>
<p>The line I needed looked like this:</p>
<pre><code>/dev/sda9 / ext3 acl,defaults 0 1</code></pre>
<p>The important part is to get &#8220;acl&#8221; into the options list. Dont forget the comma.<br />
I recommend rebooting just to make sure your fstab is set before you continue.<br />
It&#8217;s easy to screw something up here and make your system unbootable, so if you reboot, and cant get your system back up and running, get into single user mode, and use this command. (You will have to adjust /dev/sda1 to your root partition. In my experience, it is usually /dev/sda1 or /dev/hda1. Use fdisk -l to list the partitions on the disk.</p>
<pre><code>mount -o remount,rw /dev/sda1</code></pre>
<p>Now lets get the <a href="http://www.surlyjake.com/tag/samba/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Samba">samba</a> and kerberos software packages installed.</p>
<pre><code>aptitude install samba ntpdate smbclient <a href="http://www.surlyjake.com/tag/winbind/" class="st_tag internal_tag" rel="tag" title="Posts tagged with winbind">winbind</a> krb5-config krb5-user</code></pre>
<p>Put in the Workgroup/domain info when prompted if you like. They will set up some .conf files for you, but we&#8217;re not going to use them anyways. We wont worry about WINS for now.<br />
Now lets stop samba and winbind:</p>
<pre><code>/etc/init.d/samba stop /etc/init.d/winbind stop</code></pre>
<p>move the /etc/samba files somewhere</p>
<pre><code>mkdir /etc/samba/vanillaconf mv /etc/samba/* /etc/samba/vanillaconf/</code></pre>
<p>create your own /etc/samba/smb.conf: Make sure that the domain and realm fields are all caps.</p>
<pre><code>[global] workgroup = ((DOMAIN)) server string = %h server wins support = no security = ads realm = ((DOMAIN)).COM encrypt passwords = yes obey pam restrictions = yes winbind use default domain = yes winbind enum users = yes winbind enum groups = yes template shell = /bin/bash idmap uid = 10000-20000 idmap gid = 10000-20000 </code></pre>
<p>sync time</p>
<pre><code>ntpdate ((domain controller))</code></pre>
<p>now that samba knows what domain its part of, and we have a basic config for it, we need to get the authentication part working. Kerberos is the softare that communicates with your <a href="http://www.surlyjake.com/tag/active-directory/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Active Directory">Active Directory</a> domain to authenticate users.</p>
<pre><code>nano /etc/krb5.conf</code></pre>
<p>configure domain in /etc/krb5.conf. important parts:</p>
<pre><code>[libdefaults] default_realm = ((domain)).COM [realms] ((DOMAIN.COM)) = { kdc = ((domain controller)) kdc = ((backup DC)) admin_server = (domain controller)) } [domain_realm] .(domain).com = (domain controller).(domain).COM</code></pre>
<p>do a test by typing:</p>
<pre><code>kinit [username]</code></pre>
<p>then type:</p>
<pre><code>klist</code></pre>
<p>if you get some output looking like this, you are ready to go.</p>
<pre><code>Ticket cache: FILE:/tmp/krb5cc_0 Default principal: (username)@(domain).COM Valid starting Expires Service principal 04/27/09 13:54:23 04/27/09 23:54:26 krbtgt/(domain).COM@(domain).COM renew until 04/27/09 23:54:23</code></pre>
<p>To get Debian to recognize your Active Directory users, you need to update /etc/nsswitch.conf</p>
<pre><code>nano /etc/nsswitch.conf</code></pre>
<p>add &#8220;winbind&#8221; to the passwd and group lines. if you have &#8220;compat&#8221; in the line, put in like this:</p>
<pre><code>passwd: compat winbind passwd_compat: winbind group: compat winbind group_compat: winbind </code></pre>
<p>Now start samba and winbind back up</p>
<pre><code>/etc/init.d/winbind start /etc/init.d/samba start</code></pre>
<p>Join your machine to the domain.</p>
<pre><code>net ads join -U (administrative user)</code></pre>
<p>You should see</p>
<pre><code>Joined '(server name)' to realm '(domain).com'</code></pre>
<p>If you see</p>
<pre><code>No DNS domain configured for '(servername)'. Unable to perform DNS Update. DNS update failed!</code></pre>
<p>Don&#8217;t worry. Just create an entry in your DNS server for the samba machine.<br />
Test if winbind is working properly with</p>
<pre><code>wbinfo -t</code></pre>
<p>If you get</p>
<pre><code>checking the trust secret via RPC calls failed Could not check secret</code></pre>
<p>Then restart winbind:</p>
<pre><code>/etc/init.d/winbind restart</code></pre>
<p>allow AD accounts to logon to the machine:</p>
<pre><code># /etc/pam.d/common-account account sufficient pam_winbind.so account required pam_unix.so </code></pre>
<pre><code># /etc/pam.d/common-auth auth sufficient pam_winbind.so auth required pam_unix.so use_first_pass nullok_secure</code></pre>
<pre><code># /etc/pam.d/common-session session required pam_mkhomedir.so skel=/etc/skel/ umask=0066 session sufficient pam_winbind.so session required pam_unix.so</code></pre>
<p>It is critical that &#8220;obey pam restrictions&#8221; is set to &#8220;yes&#8221;. in your smb.conf for these pam settings to take effect.There are some other changes to these Pam.d settings i decided to make upon putting the server into production. I will write about that in another page [link].</p>
<p>Now, give your admin group from AD root access to the box</p>
<pre><code>aptitude install sudo visudo</code></pre>
<p>add this line:</p>
<pre><code>%(domain)\\(admin's group) ALL =(ALL) ALL</code></pre>
<p>When creating shares, to give an AD user access to a <a href="http://www.surlyjake.com/tag/share/" class="st_tag internal_tag" rel="tag" title="Posts tagged with share">share</a>, use:(More info in the future)</p>
<pre><code>valid users = (domain)\username</code></pre>
<p>to give an AD group access to a share, use:</p>
<pre><code>valid users = @(domain)\groupname</code></pre>
<p>Sometimes, I have to reboot my <a href="http://www.surlyjake.com/tag/windows/" class="st_tag internal_tag" rel="tag" title="Posts tagged with windows">windows</a> client machine to make it work&#8230; fyi.<br />
Sources:</p>
<ul>
<li>O&#8217;reilly Samba book 3rd Edition.</li>
<li><a href="http://www.ccs.neu.edu/home/battista/documentation/winbind/index.html">http://www.ccs.neu.edu/home/battista/documentation/winbind/index.html</a></li>
<li>&#8230;Countless articles, mailing lists, forums.</li>
</ul>
<div class="none"><div class="g-plusone" data-href="http://www.surlyjake.com/2009/05/join-debian-lenny-to-active-directory-using-samba/" size="standard" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.surlyjake.com/2009/05/join-debian-lenny-to-active-directory-using-samba/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>Debian Samba share. no password. read only</title>
		<link>http://www.surlyjake.com/2008/10/debian-samba-share-no-password-read-only/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=debian-samba-share-no-password-read-only</link>
		<comments>http://www.surlyjake.com/2008/10/debian-samba-share-no-password-read-only/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 18:28:24 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Debian Etch]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.surlyjake.com/?p=63</guid>
		<description><![CDATA[Just install samba server: apt-get install samba edit the config: nano /etc/samba/smb.conf set security to &#8220;share&#8221; security = share and guest account to nobody guest account = nobody then you just need to create your share like this: [guest share] comment = a guest share path = /path/to/files browseable = yes read only = yes [...]]]></description>
			<content:encoded><![CDATA[<p>Just install <a href="http://www.surlyjake.com/tag/samba/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Samba">samba</a> server:</p>
<pre><code><a href="http://www.surlyjake.com/tag/apt/" class="st_tag internal_tag" rel="tag" title="Posts tagged with apt">apt</a>-get install samba
</code></pre>
<p>edit the config:</p>
<pre><code>nano /etc/samba/smb.conf
</code></pre>
<p>set security to &#8220;<a href="http://www.surlyjake.com/tag/share/" class="st_tag internal_tag" rel="tag" title="Posts tagged with share">share</a>&#8221;</p>
<pre><code>security = share
</code></pre>
<p>and guest account to nobody</p>
<pre><code>guest account = nobody
</code></pre>
<p>then you just need to create your share like this:</p>
<pre><code>[guest share]
comment = a guest share
path = /path/to/files
browseable = yes
read only = yes
guest ok = yes
</code></pre>
<div class="none"><div class="g-plusone" data-href="http://www.surlyjake.com/2008/10/debian-samba-share-no-password-read-only/" size="standard" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.surlyjake.com/2008/10/debian-samba-share-no-password-read-only/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uninstall MySQL 5 from Debian</title>
		<link>http://www.surlyjake.com/2008/09/uninstall-mysql-5-from-debian/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=uninstall-mysql-5-from-debian</link>
		<comments>http://www.surlyjake.com/2008/09/uninstall-mysql-5-from-debian/#comments</comments>
		<pubDate>Sat, 27 Sep 2008 14:12:32 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Debian Etch]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Samba]]></category>
		<category><![CDATA[Zabbix]]></category>
		<category><![CDATA[apt]]></category>
		<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://www.surlyjake.com/?p=34</guid>
		<description><![CDATA[I completely. completely messed up MySQL. Badly. I wiped out the data directory (/var/lib/mysql in Debian) and the went to remove mysql &#8230; apt-get remove --purge mysql-server That only deleted something like 86K. dissapointing. It looks like &#8220;mysql-server&#8221; is a shortcut pointing to the latest version of the software. The real software is found  under [...]]]></description>
			<content:encoded><![CDATA[<p>I completely. <span style="text-decoration: underline;">completely </span>messed up <a href="http://www.surlyjake.com/tag/mysql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with MySQL">MySQL</a>. Badly. I wiped out the data directory (/var/lib/<a href="http://www.surlyjake.com/tag/mysql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with MySQL">mysql</a> in <a href="http://www.surlyjake.com/tag/debian/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Debian">Debian</a>) and the went to remove mysql &#8230;<br />
<code><a href="http://www.surlyjake.com/tag/apt/" class="st_tag internal_tag" rel="tag" title="Posts tagged with apt">apt</a>-get remove --purge mysql-server<br />
</code><br />
That only deleted something like 86K. dissapointing. It looks like &#8220;mysql-server&#8221; is a shortcut pointing to the latest version of the software. The real software is found  under the name &#8220;mysql-server-50&#8243;. So what made it happen was:<br />
<code>apt-get remove --purge mysql-server*<br />
</code><br />
That&#8217;ll wipe out whatever mysql install is in place.</p>
<div class="none"><div class="g-plusone" data-href="http://www.surlyjake.com/2008/09/uninstall-mysql-5-from-debian/" size="standard" count="true"></div></div>]]></content:encoded>
			<wfw:commentRss>http://www.surlyjake.com/2008/09/uninstall-mysql-5-from-debian/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

