<p>Indeed there is a specific set of actions to be performed on a newly created container which is to be used to make a template. This includes:<br>
- log files truncation;<br>
- yum/apt database cleanup;<br>
- adjustments to cron jobs and init.d services;<br>
- making sure ssh keys are unique (this is specific to Debian, maybe Ubuntu -- they generate key pairs on SSH package installation not the first run);<br>
- disabling root login (usermod -L root should be sufficient, although it&#39;s always better to check);<br>
- removing getty entries from inittab (or its upstart/systemd analog) — since there are no terminals in CT;<br>
- making sure syslogd don&#39;t do sync () for each log line written (this ruins I/O performance if you have tens or hundreds of CTs);<br>
- proper software repository configuration;<br>
- (optional) removal of unneeded packages (like kernel) just for the sake of disk space savings (this is usually done by creating stub &quot;dummy&quot; packages that virtually provide the stuff required by other packages but not really needed;<br>

- (optional) removal of some extra stuff like locale data;<br>
- linking /etc/mtab to /proc/mounts (although it might not be needed);<br>
- something else I can&#39;t remember at the moment.</p>
<p>Then, some things are performed by vzctl&#39;s postcteate.sh script which is run during vzctl create. This, among other things, include crontab times randomization, to prevent all CTs to run say cron.daily jobs at the same time.</p>

<p>Hope that helps,<br>
  Kir.</p>
<p>--<br>
Sent from my Android phone</p>
<div class="gmail_quote">On Sep 15, 2011 12:57 AM, &quot;Kelvin Raywood&quot; &lt;<a href="mailto:kray@triumf.ca">kray@triumf.ca</a>&gt; wrote:<br type="attribution">&gt; Scott Dowdle wrote:<br>&gt;&gt; ...<br>&gt;&gt; The final products are a i386 and an x86_64 contributed SL 5.7 OS Template.<br>
&gt; <br>&gt; Thanks very much for these Scott.  This is much appreciated.<br>&gt; <br>&gt; I just wanted to mention one thing that I got bitten by recently with a <br>&gt; template from contrib.<br>&gt; <br>&gt; In the official templates, /etc/shadow has * in the encrypted-password <br>
&gt; field for root so that you can&#39;t login as root using a password.<br>&gt; In April, an early SL-6.0 template was contributed <br>&gt; (scientificlinux-6.0-x86.tar.gz Apr-11-2011) which has an encrypted <br>&gt; password string for root.<br>
&gt; <br>&gt; We normally disable password access to root in /etc/ssh/sshd_config via <br>&gt; &quot;PermitRootLogin without-password&quot; and use ssh keys or &quot;vzctl enter&quot; to<br>&gt; get root access so didn&#39;t notice that the machine had a root password <br>
&gt; enabled.  Also, since it was our first SL-6 container, we didn&#39;t have <br>&gt; our deployment procedure sorted out properly and this was the <br>&gt; sshd_config part.<br>&gt; <br>&gt; It didn&#39;t take long for some spider to find the machine and guess the <br>
&gt; password.  An IRC robot was installed and /root/.ssh/authorized_keys was <br>&gt; overwritten.   We noticed fairly quickly and then cracked the password <br>&gt; string.<br>&gt; <br>&gt; Anyway, we learned our lesson but I think it would also be good practice <br>
&gt; for contributors to check that their template does not have a root password.<br>&gt; <br>&gt; Oh yeah - the cracked password ... password<br>&gt; <br>&gt; --<br>&gt; Kel Raywood<br>&gt; TRIUMF<br>&gt; Vancouver BC<br>
&gt; <br>&gt; _______________________________________________<br>&gt; Users mailing list<br>&gt; <a href="mailto:Users@openvz.org">Users@openvz.org</a><br>&gt; <a href="https://openvz.org/mailman/listinfo/users">https://openvz.org/mailman/listinfo/users</a><br>
</div>