<?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>SysAdmin Valley &#187; command line</title>
	<atom:link href="http://www.sysadminvalley.com/tag/command-line/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sysadminvalley.com</link>
	<description>I might as well write this stuff down so I remember it tomorrow</description>
	<lastBuildDate>Wed, 25 Jan 2012 15:06:43 +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>Redirect wget output to screen (STDOUT)</title>
		<link>http://www.sysadminvalley.com/2012/01/25/redirect-wget-output-to-screen-stdout/</link>
		<comments>http://www.sysadminvalley.com/2012/01/25/redirect-wget-output-to-screen-stdout/#comments</comments>
		<pubDate>Wed, 25 Jan 2012 15:06:43 +0000</pubDate>
		<dc:creator>mshields</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[mini how-to]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://www.sysadminvalley.com/?p=326</guid>
		<description><![CDATA[wget is a great tool for grabbing web pages from the command line, but one issue is it downloads the file and saves to the local directory.  Some times you just want to see the output of what is retrieved.  To do this, use the following command: wget -qO- http://www.mywebsite.com/file.htm]]></description>
			<content:encoded><![CDATA[<p>wget is a great tool for grabbing web pages from the command line, but one issue is it downloads the file and saves to the local directory.  Some times you just want to see the output of what is retrieved.  To do this, use the following command:</p>
<blockquote><p>wget -qO- http://www.mywebsite.com/file.htm</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sysadminvalley.com/2012/01/25/redirect-wget-output-to-screen-stdout/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Piping Tar over SSH</title>
		<link>http://www.sysadminvalley.com/2011/10/25/piping-tar-over-ssh/</link>
		<comments>http://www.sysadminvalley.com/2011/10/25/piping-tar-over-ssh/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 12:37:13 +0000</pubDate>
		<dc:creator>mshields</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://www.sysadminvalley.com/?p=319</guid>
		<description><![CDATA[I recently had the issue where I wanted to Tar/Gzip up a large directory but didn&#8217;t have the available space on the server, but I need to get it transfered over to another server.  So I came up with two options.  First, Tar/Gzip it and pipe it over SSH and create the tgz file on [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had the issue where I wanted to Tar/Gzip up a large directory but didn&#8217;t have the available space on the server, but I need to get it transfered over to another server.  So I came up with two options.  First, Tar/Gzip it and pipe it over SSH and create the tgz file on the remote host, or just pipe and extract it directly on the other host.</p>
<p>The first option, creating the tgz on the remote host can be accomplished by doing this</p>
<blockquote><p>cd /my/path<br />
tar czf &#8211; . | ssh remoteserver &#8220;cat &gt; /new/path/file.tar.gz&#8221;</p></blockquote>
<p>The second option, creating the tgz but extracting the contents directly on the remote host can be accomplished by doing this.</p>
<blockquote><p>cd /my/path<br />
tar czf &#8211; . | ssh remoteserver &#8220;cd /remote/path; tar xzf -&#8221;</p></blockquote>
<p>Another thing you can do is if you want a path on a remote server but you want to pull it to the local server and extract it you can run the following</p>
<blockquote><p>
cd /my/path<br />
ssh remote &#8220;cd /my/path; tar czf &#8211; .&#8221; | tar xfz -
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sysadminvalley.com/2011/10/25/piping-tar-over-ssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grepping in a Windows World</title>
		<link>http://www.sysadminvalley.com/2011/05/31/grepping-in-a-windows-world/</link>
		<comments>http://www.sysadminvalley.com/2011/05/31/grepping-in-a-windows-world/#comments</comments>
		<pubDate>Tue, 31 May 2011 13:48:12 +0000</pubDate>
		<dc:creator>mshields</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[mini how-to]]></category>
		<category><![CDATA[powershell]]></category>

		<guid isPermaLink="false">http://www.sysadminvalley.com/?p=307</guid>
		<description><![CDATA[Lately I&#8217;ve been doing more work on Windows platforms and I&#8217;ve been missing the Linux command line.  I&#8217;m a huge user of cat, sed, awk and most of all grep. I&#8217;m also a huge bash script writer to help with everyday issues.  Recently I started playing around with Windows PowerShell and so I&#8217;ll be starting [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been doing more work on Windows platforms and I&#8217;ve been missing the Linux command line.  I&#8217;m a huge user of cat, sed, awk and most of all grep. I&#8217;m also a huge bash script writer to help with everyday issues.  Recently I started playing around with Windows PowerShell and so I&#8217;ll be starting to list PowerShell tips from time to time.  No I haven&#8217;t totally gone to the dark side, I&#8217;m still a huge Linux user, but PowerShell does seem like a nice option when you have to use Windows.</p>
<p>So, my latest issue is I needed to search through lots of logs to find an email address.  Normally I&#8217;d use grep to parse through the files.  Instead I opened up a Powershell prompt and used the following command</p>
<blockquote><p>findstr /I my@email.com logfile.log</p></blockquote>
<p>Findstr is just like grep and has a lot of the same options.  The <strong>/I</strong> tells it to be case-insensitive.  The <strong>my@email.com</strong> is what I&#8217;m looking for in <strong>logfile.log</strong>.  Here are the different settings that you can use:</p>
<blockquote><p>FINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P] [/F:file]<br />
[/C:string] [/G:file] [/D:dir list] [/A:color attributes] [/OFF[LINE]]<br />
strings [[drive:][path]filename[ ...]]</p>
<p>/B         Matches pattern if at the beginning of a line.<br />
/E         Matches pattern if at the end of a line.<br />
/L         Uses search strings literally.<br />
/R         Uses search strings as regular expressions.<br />
/S         Searches for matching files in the current directory and all<br />
subdirectories.<br />
/I         Specifies that the search is not to be case-sensitive.<br />
/X         Prints lines that match exactly.<br />
/V         Prints only lines that do not contain a match.<br />
/N         Prints the line number before each line that matches.<br />
/M         Prints only the filename if a file contains a match.<br />
/O         Prints character offset before each matching line.<br />
/P         Skip files with non-printable characters.<br />
/OFF[LINE] Do not skip files with offline attribute set.<br />
/A:attr    Specifies color attribute with two hex digits. See &#8220;color /?&#8221;<br />
/F:file    Reads file list from the specified file(/ stands for console).<br />
/C:string  Uses specified string as a literal search string.<br />
/G:file    Gets search strings from the specified file(/ stands for console).<br />
/D:dir     Search a semicolon delimited list of directories<br />
strings    Text to be searched for.<br />
[drive:][path]filename<br />
Specifies a file or files to search.</p>
<p>Use spaces to separate multiple search strings unless the argument is prefixed<br />
with /C.  For example, &#8216;FINDSTR &#8220;hello there&#8221; x.y&#8217; searches for &#8220;hello&#8221; or<br />
&#8220;there&#8221; in file x.y.  &#8216;FINDSTR /C:&#8221;hello there&#8221; x.y&#8217; searches for<br />
&#8220;hello there&#8221; in file x.y.</p>
<p>Regular expression quick reference:<br />
.        Wildcard: any character<br />
*        Repeat: zero or more occurrences of previous character or class<br />
^        Line position: beginning of line<br />
$        Line position: end of line<br />
[class]  Character class: any one character in set<br />
[^class] Inverse class: any one character not in set<br />
[x-y]    Range: any characters within the specified range<br />
\x       Escape: literal use of metacharacter x<br />
\&lt;xyz    Word position: beginning of word<br />
xyz\&gt;    Word position: end of word</p>
<p>For full information on FINDSTR regular expressions refer to the online Command<br />
Reference.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sysadminvalley.com/2011/05/31/grepping-in-a-windows-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rebooting Windows Machines Through Remote Desktop</title>
		<link>http://www.sysadminvalley.com/2011/03/11/rebooting-windows-machines-through-remote-desktop/</link>
		<comments>http://www.sysadminvalley.com/2011/03/11/rebooting-windows-machines-through-remote-desktop/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 15:30:15 +0000</pubDate>
		<dc:creator>mshields</dc:creator>
				<category><![CDATA[microsoft]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.sysadminvalley.com/?p=299</guid>
		<description><![CDATA[With Windows XP, Vista, 7, and Windows Server 2003 and 2008 you now cannot shutdown the machine from the Start button when you are logged in via Remote Desktop (RDP).  To reboot the server run: shutdown -t 0 -r -f If you want to just shut it off, run (notice that -r is missing, this [...]]]></description>
			<content:encoded><![CDATA[<p>With Windows XP, Vista, 7, and Windows Server 2003 and 2008 you now cannot shutdown the machine from the Start button when you are logged in via Remote Desktop (RDP).  To reboot the server run:</p>
<blockquote><p>shutdown -t 0 -r -f</p></blockquote>
<p>If you want to just shut it off, run (notice that -r is missing, this means it will not be rebooted):</p>
<blockquote><p>shutdown -t 0 -f</p></blockquote>
<p>The &#8220;-t 0&#8243; tells the system to wait zero seconds be shutting down or rebooting.  You can change the zero to any number of seconds you want.  The &#8220;-f&#8221; tells the system to not prompt for confirmation.  So make sure you really want the server shut down or rebooted.</p>
<p>There are other options that you can use, you can see all the options on the Microsoft site <a href="http://support.microsoft.com/kb/317371" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sysadminvalley.com/2011/03/11/rebooting-windows-machines-through-remote-desktop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Backing up a cPanel account via command line</title>
		<link>http://www.sysadminvalley.com/2010/08/27/backing-up-a-cpanel-account-via-command-line/</link>
		<comments>http://www.sysadminvalley.com/2010/08/27/backing-up-a-cpanel-account-via-command-line/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 14:33:42 +0000</pubDate>
		<dc:creator>mshields</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[cPanel]]></category>
		<category><![CDATA[mini how-to]]></category>

		<guid isPermaLink="false">http://www.sysadminvalley.com/?p=242</guid>
		<description><![CDATA[In the past I&#8217;ve needed a way to backup an entire cPanel account on my servers so the following has come in real handy.  Just run the following command from the shell and substitute [username] for the username you want to backup (also remove the []).  At the end of the backup process it will [...]]]></description>
			<content:encoded><![CDATA[<p>In the past I&#8217;ve needed a way to backup an entire cPanel account on my servers so the following has come in real handy.  Just run the following command from the shell and substitute [username] for the username you want to backup (also remove the []).  At the end of the backup process it will tell you where the backup file is located, usually it&#8217;s in the /home/ directory on most servers and is named cpmove-username.tar.gz</p>
<blockquote><p>/scripts/pkgacct [username]</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sysadminvalley.com/2010/08/27/backing-up-a-cpanel-account-via-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Excluding files in FIND results</title>
		<link>http://www.sysadminvalley.com/2010/03/09/excluding-files-in-find-results/</link>
		<comments>http://www.sysadminvalley.com/2010/03/09/excluding-files-in-find-results/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 19:31:09 +0000</pubDate>
		<dc:creator>mshields</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[mini how-to]]></category>

		<guid isPermaLink="false">http://www.sysadminvalley.com/?p=195</guid>
		<description><![CDATA[Find is one of my favorite little tools under linux.  It helps me &#8220;find&#8221; almost anything, I can find files older than a certain date, newer than a certain date, modified on a certain date.  I can find files that have a certain name, or match a part of a name, file extension.  Once I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>Find is one of my favorite little tools under <a target="_blank" href="http://www.beantownsoftware.com/linux.html?node=96394&rattr=operating_systems-red_hat">linux</a>.  It helps me &#8220;find&#8221; almost anything, I can find files older than a certain date, newer than a certain date, modified on a certain date.  I can find files that have a certain name, or match a part of a name, file extension.  Once I&#8217;ve found what I&#8217;ve been looking for I can have find do something with those files like delete them or gzip them.</p>
<p>My latest &#8220;find&#8221; with the find command came about because on one of my JBoss servers I wrote a simple script that looks for log files older than 15 days and deletes them and looks for other log files older than 61 minutes and compresses them with gzip.</p>
<blockquote><p>#!/bin/bash<br />
LOGS=/usr/local/jboss/server/all/log/<br />
#delete all logs older than 37 days<br />
find $LOGS -mtime +15 | xargs rm -rf<br />
# gzip files last modify at least 1 hour ago<br />
find $LOGS -mmin +61 | xargs gzip</p></blockquote>
<p>Our JBoss setup automatically writes new logs to server.info.log and server.error.log, then every every hour it renames the INFO and ERROR log to the current date + hour, so server.info.log would be changed to server.info.log.2010-03-09-13 for today at 2pm to roll out the 1pm logs.</p>
<p>The problem I came across in my script was with my server.error.log file.  If an error hasn&#8217;t been written to the server.error.log file during that hour, it wasn&#8217;t going to rotate an empty error log.  Since the file hadn&#8217;t been touched/updated/modified in over 61 minutes, my script came along and gzipped it, at this point JBoss then had a problem because the error log was missing and didn&#8217;t create a new one.</p>
<p>So what I needed to do was to find all the files that matched the criteria, but exclude the server.info.log and server.error.log and here is my final script.</p>
<blockquote><p>#!/bin/bash<br />
LOGS=/usr/local/jboss/server/all/log/<br />
INFOLOG=&#8221;server.info.log&#8221;<br />
ERRORLOG=&#8221;server.error.log&#8221;<br />
#delete all logs older than 37 days<br />
find $LOGS -mtime +15 -not -name &#8220;$INFOLOG&#8221; -not -name &#8220;$ERRORLOG&#8221; | xargs rm -rf<br />
# gzip files last modify at least 1 hour ago<br />
find $LOGS -mmin +61 -not -name &#8220;$INFOLOG&#8221; -not -name &#8220;$ERRORLOG&#8221; | xargs gzip</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sysadminvalley.com/2010/03/09/excluding-files-in-find-results/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Converting Uppercase to Lowercase (and vice-versus)</title>
		<link>http://www.sysadminvalley.com/2009/07/06/converting-uppercase-to-lowercase-and-vice-versus/</link>
		<comments>http://www.sysadminvalley.com/2009/07/06/converting-uppercase-to-lowercase-and-vice-versus/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 19:01:18 +0000</pubDate>
		<dc:creator>mshields</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[mini how-to]]></category>

		<guid isPermaLink="false">http://www.sysadminvalley.com/?p=100</guid>
		<description><![CDATA[I love bash and scripting!!!  There&#8217;s almost nothing you can&#8217;t do with a shell script that would take me forever if I had to write an app to do the same.  So here&#8217;s another quick tip.  To convert text in a file from uppercase to lowercase use the following: cat FILENAME &#124; tr &#8220;[:upper:]&#8221; &#8220;[:lower:]&#8220; [...]]]></description>
			<content:encoded><![CDATA[<p>I love bash and scripting!!!  There&#8217;s almost nothing you can&#8217;t do with a shell script that would take me forever if I had to write an app to do the same.  So here&#8217;s another quick tip.  To convert text in a file from uppercase to lowercase use the following:</p>
<blockquote><p>cat FILENAME | tr &#8220;[:upper:]&#8221; &#8220;[:lower:]&#8220;</p></blockquote>
<p>Or to go from lowercase to uppercase:</p>
<blockquote><p>cat FILENAME | tr &#8220;[:lower:]&#8221; &#8220;[:upper:]&#8220;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sysadminvalley.com/2009/07/06/converting-uppercase-to-lowercase-and-vice-versus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using seq to generate a list of numbers</title>
		<link>http://www.sysadminvalley.com/2009/06/30/using-seq-to-generate-a-list-of-numbers/</link>
		<comments>http://www.sysadminvalley.com/2009/06/30/using-seq-to-generate-a-list-of-numbers/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 20:06:56 +0000</pubDate>
		<dc:creator>mshields</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[mini how-to]]></category>

		<guid isPermaLink="false">http://www.sysadminvalley.com/?p=96</guid>
		<description><![CDATA[Another quick hint.  While working on a server I needed to bring up a whole lot of IP addresses (200 to be exact).  If I really wanted to I could bring them all up like this: ifconfig eth0:2 1.1.1.2 netmask 255.255.255.0 up ifconfig eth0:3 1.1.1.3 netmask 255.255.255.0 up and so on to&#8230;.. ifconfig eth0:200 1.1.1.200 [...]]]></description>
			<content:encoded><![CDATA[<p>Another quick hint.  While working on a server I needed to bring up a whole lot of IP addresses (200 to be exact).  If I really wanted to I could bring them all up like this:</p>
<blockquote><p>ifconfig eth0:2 1.1.1.2 netmask 255.255.255.0 up<br />
ifconfig eth0:3 1.1.1.3 netmask 255.255.255.0 up<br />
and so on to&#8230;..<br />
ifconfig eth0:200 1.1.1.200 netmask 255.255.255.0 up</p></blockquote>
<p>Well, I&#8217;m always looking for an easier way, so I turned to my friend BASH and a tool called SEQ.  SEQ will give you a sequence of numbers.  For example if you just wanted 10 numbers you could do the following:</p>
<blockquote><p>[matt@localhost ~]$ seq 5<br />
1<br />
2<br />
3<br />
4<br />
5</p></blockquote>
<p>So for this task I needed to bring up IP addresses from 2 through 254.  Running &#8220;seq 2 254&#8243; will give me a sequence from 2 to 254, I need more than just to have a list of numbers, I actually need to use them, so here&#8217;s the syntax I used to use the numbers to bring up each of the interfaces</p>
<blockquote><p>for i in $(seq 2 254)<br />
do<br />
ifconfig eth0:$i 1.1.1.$i netmask 255.255.255.0 up<br />
done</p></blockquote>
<p>Obviously in the above example, you would substitute the sequence you want to use and the IP subnet you want to use.  Also, this syntax would put 1.1.1.2 on sub-interface eth0:2, 1.1.1.3 on sub-interface eth0:3, etc.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sysadminvalley.com/2009/06/30/using-seq-to-generate-a-list-of-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Curl requests by binding to different IP address</title>
		<link>http://www.sysadminvalley.com/2009/06/29/curl-requests-by-binding-to-different-ip-address/</link>
		<comments>http://www.sysadminvalley.com/2009/06/29/curl-requests-by-binding-to-different-ip-address/#comments</comments>
		<pubDate>Mon, 29 Jun 2009 15:29:37 +0000</pubDate>
		<dc:creator>mshields</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[mini how-to]]></category>

		<guid isPermaLink="false">http://www.sysadminvalley.com/?p=91</guid>
		<description><![CDATA[From time to time I need to use Curl to test websites and sometimes I need to make the request come from a different IP address, other than the server&#8217;s default IP.  Note, the IP address you use must be active on your server.  To do this, use the following syntax: curl --interface xxx.xxx.xxx.xxx -s [...]]]></description>
			<content:encoded><![CDATA[<p>From time to time I need to use Curl to test websites and sometimes I need to make the request come from a different IP address, other than the server&#8217;s default IP.  Note, the IP address you use must be active on your server.  To do this, use the following syntax:</p>
<blockquote>
<pre>curl --interface xxx.xxx.xxx.xxx -s http://www.sysadminvalley.com</pre>
</blockquote>
<p>Make sure that you substitute xxx.xxx.xxx.xxx with the IP address you want to use.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sysadminvalley.com/2009/06/29/curl-requests-by-binding-to-different-ip-address/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a self-signed SSL Certificate</title>
		<link>http://www.sysadminvalley.com/2009/02/17/creating-a-self-signed-ssl-certificate/</link>
		<comments>http://www.sysadminvalley.com/2009/02/17/creating-a-self-signed-ssl-certificate/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 15:16:24 +0000</pubDate>
		<dc:creator>mshields</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[mini how-to]]></category>

		<guid isPermaLink="false">http://www.sysadminvalley.com/?p=72</guid>
		<description><![CDATA[For this you will need the openssl package.  First we want to start by generating a private key. root@localhost# openssl genrsa -out www.mydomain.com.key 1024 Generating RSA private key, 1024 bit long modulus &#8230;&#8230;&#8230;&#8230;.++++++ &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..++++++ e is 65537 (0&#215;10001) Then, we need to generate the certificate request and fill in the appropriate information.  Make sure that [...]]]></description>
			<content:encoded><![CDATA[<p>For this you will need the openssl package.  First we want to start by generating a private key.</p>
<blockquote><p>root@localhost# openssl genrsa -out www.mydomain.com.key 1024<br />
Generating RSA private key, 1024 bit long modulus<br />
&#8230;&#8230;&#8230;&#8230;.++++++<br />
&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;..++++++<br />
e is 65537 (0&#215;10001)</p></blockquote>
<p>Then, we need to generate the certificate request and fill in the appropriate information.  Make sure that the &#8220;Common Name&#8221; matches the domain you want to protect via SSL, so if you domain was www.mydomain.com, use that.  If you wanted to protect mydomain.com (without the www.) then use that.</p>
<blockquote><p>root@localhost# openssl req -new -key www.mydomain.com.key -out www.mydomain.com.csr<br />
You are about to be asked to enter information that will be incorporated<br />
into your certificate request.<br />
What you are about to enter is what is called a Distinguished Name or a DN.<br />
There are quite a few fields but you can leave some blank<br />
For some fields there will be a default value,<br />
If you enter &#8216;.&#8217;, the field will be left blank.<br />
&#8212;&#8211;<br />
Country Name (2 letter code) [GB]:<br />
State or Province Name (full name) [Berkshire]:<br />
Locality Name (eg, city) [Newbury]:<br />
Organization Name (eg, company) [My Company Ltd]:<br />
Organizational Unit Name (eg, section) []:<br />
Common Name (eg, your name or your server&#8217;s hostname) []:www.mydomain.com<br />
Email Address []:email@mydomain.com</p>
<p>Please enter the following &#8216;extra&#8217; attributes<br />
to be sent with your certificate request<br />
A challenge password []:<br />
An optional company name []:</p></blockquote>
<p>Next, generate the self-signed certificate. You can specify the number of days the cert is valid for.</p>
<blockquote><p>root@localhost# openssl x509 -req -days 365 -in www.mydomain.com.csr -signkey www.mydomain.com.key -out www.mydomain.com.crt<br />
Signature ok<br />
subject=/C=/ST=/L=/O=/CN=www.mydomain.com/emailAddress=email@mydomain.com<br />
Getting Private key</p></blockquote>
<p>Next, move the certificate and keyfile into apache&#8217;s SSL directory.</p>
<blockquote><p>mv www.mydomain.com.key /etc/httpd/conf/ssl.key/<br />
mv www.mydomain.com.crt /etc/httpd/conf/ssl.crt/</p></blockquote>
<p>Finally, we configure our SSL virtual host in Apache.  The simplest way to do this is to copy the virtual host for the site you want to make SSL, then add/change the following bits.</p>
<blockquote><p>&lt;VirtualHost 192.168.1.100:443&gt;<br />
&#8230;<br />
SSLEngine on<br />
SSLCertificateFile /etc/httpd/conf/ssl.key/www.mydomain.com.key<br />
SSLCertificateKeyFile /etc/httpd/conf/ssl.crt/www.mydomain.com.crt<br />
&#8230;<br />
&lt;/VirtualHost&gt;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sysadminvalley.com/2009/02/17/creating-a-self-signed-ssl-certificate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

