<?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>Swift Byte Blog</title> <atom:link href="http://blog.swiftbyte.com/feed/" rel="self" type="application/rss+xml" /><link>http://blog.swiftbyte.com</link> <description>Blogging my adventures in coding and computers.</description> <lastBuildDate>Fri, 16 Dec 2011 19:21:28 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>Extremely Slow Wifi Speeds After Installing Ubuntu</title><link>http://blog.swiftbyte.com/linux/extremely-slow-wifi-speeds-after-installing-ubuntu/</link> <comments>http://blog.swiftbyte.com/linux/extremely-slow-wifi-speeds-after-installing-ubuntu/#comments</comments> <pubDate>Fri, 18 Nov 2011 04:43:05 +0000</pubDate> <dc:creator>Joe</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Ubuntu]]></category><guid isPermaLink="false">http://blog.swiftbyte.com/?p=185</guid> <description><![CDATA[The other day I decided to install Ubuntu 11.10 Oneiric Ocelot nativly on my Dell Studio 1737 laptop. Everything went great except for one thing. When it came time to connect to the Internet or any network resource for that matter I was reminded of the days of dial up in that things were VERY [...]]]></description> <content:encoded><![CDATA[<p>The other day I decided to install Ubuntu 11.10 Oneiric Ocelot nativly on my Dell Studio 1737 laptop. Everything went great except for one thing. When it came time to connect to the Internet or any network resource for that matter I was reminded of the days of dial up in that things were VERY slow. The problem seems to be with the iwlagn module produced by the iwlwifi Linux kernel driver which supports several Intel wireless LAN adapters. There would seem to be a bug in it causing a huge speed decrease when conneted to a 802.11n network. The only solutions I found was to do one of the following things:<span id="more-185"></span></p><p><del>Disable 802.11n  and downgrade to g on your wireless access point.</del></p><p><del></del> (Not an exceptable answer to me due to the fact I have other products running n that have no issues. Why should I suffer on these devices because my laptop fails to run on it.)</p><p>And the other solution I was able to hunt down which is the one I am using until a fix for the issue surfaces which involves forcing iwlagn to not use n. Before making the change permanant run the following commands from a console window. The commands will disable n on the device without making it a permanant change to see if this fix will actually work for you before editing files. If this solution don&#8217;t work a simple reboot will bring you back to where you were.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> rmmod iwlagn
<span style="color: #c20cb9; font-weight: bold;">sudo</span> modprobe iwlagn <span style="color: #000000;">11</span><span style="color: #007800;">n_disable</span>=<span style="color: #000000;">1</span></pre></div></div><p>If after running the above commands you notice greatly improved speeds then you can make them permanent by doing the following.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>modprobe.d<span style="color: #000000; font-weight: bold;">/</span>options.conf</pre></div></div><p>Then add the following line to this file.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">options iwlagn <span style="color: #000000;">11</span><span style="color: #007800;">n_disable</span>=<span style="color: #000000;">1</span></pre></div></div>]]></content:encoded> <wfw:commentRss>http://blog.swiftbyte.com/linux/extremely-slow-wifi-speeds-after-installing-ubuntu/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Setting up XDebug to Debug PHP Applications</title><link>http://blog.swiftbyte.com/web-development/setting-up-xdebug-to-debug-php-applications/</link> <comments>http://blog.swiftbyte.com/web-development/setting-up-xdebug-to-debug-php-applications/#comments</comments> <pubDate>Mon, 26 Sep 2011 16:06:43 +0000</pubDate> <dc:creator>Joe</dc:creator> <category><![CDATA[Web Development]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[XDebug]]></category><guid isPermaLink="false">http://blog.swiftbyte.com/?p=175</guid> <description><![CDATA[The following are general instructions as to how to set up XDebug and should work for most any environment you may be using whether it is Apache or IIS. You will want to make sure before continuing that you have a web server installed and running on which to do your PHP debugging using XDebug. First [...]]]></description> <content:encoded><![CDATA[<p>The following are general instructions as to how to set up XDebug and should work for most any environment you may be using whether it is Apache or IIS. You will want to make sure before continuing that you have a web server installed and running on which to do your PHP debugging using XDebug.</p><p>First you will need to download the latest version of XDebug from <a href="http://xdebug.org/download.php">http://xdebug.org/download.php</a> for the type of system your web server is running on.<span id="more-175"></span></p><p>Next place the XDebug binary you just downloaded into your PHP extensions directory depending on where you installed PHP for example C:\PHP\ext\.</p><p>Now you will need to open your php.ini file in your favorite text editor and add the following lines to the end of the file. These setting will later on help you in setting up tools such as Eclipse to work properly with XDebug on this server.</p><p>[xdebug]<br /> xdebug.remote_enable=1<br /> xdebug.remote_host=&#8221;localhost&#8221;<br /> xdebug.remote_port=9000<br /> xdebug.remote_handler=&#8221;dbgp&#8221;<br /> zend_extension = C:\PHP\ext\php_xdebug-&lt;replace with correct version&gt;.dll</p><p>Restart your web server or PHP process to allow for these changes to take place and check your phpinfo() output to make sure XDebug set up properly.</p> ]]></content:encoded> <wfw:commentRss>http://blog.swiftbyte.com/web-development/setting-up-xdebug-to-debug-php-applications/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Setting Up XDebug under Microsoft Internet Information Services (IIS) 7</title><link>http://blog.swiftbyte.com/web-development/setting-up-xdebug-under-microsoft-internet-information-services-iis-7/</link> <comments>http://blog.swiftbyte.com/web-development/setting-up-xdebug-under-microsoft-internet-information-services-iis-7/#comments</comments> <pubDate>Sun, 25 Sep 2011 03:43:53 +0000</pubDate> <dc:creator>Joe</dc:creator> <category><![CDATA[Web Development]]></category> <category><![CDATA[Microsoft IIS]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[XDebug]]></category><guid isPermaLink="false">http://blog.swiftbyte.com/?p=154</guid> <description><![CDATA[This post covers the set up of XDebug for use in debuging PHP using IIS 7 with PHP installed using FastCGI. This post does not cover the installation and configuration of IIS 7 and PHP only what to do to enable XDebug in this environment. If you have not yet installed Microsoft Internet Information Services(IIS) 7 or have yet to set up [...]]]></description> <content:encoded><![CDATA[<p>This post covers the set up of XDebug for use in debuging PHP using IIS 7 with PHP installed using FastCGI. This post does not cover the installation and configuration of IIS 7 and PHP only what to do to enable XDebug in this environment. If you have not yet installed Microsoft Internet Information Services(IIS) 7 or have yet to set up PHP on IIS 7 you may wish to check out the post I made earlier entitled &#8220;<a href="http://blog.swiftbyte.com/microsoft-windows/setting-up-iis-7-and-php-using-fastcgi-in-a-microsoft-window-environment/">Setting Up IIS 7 and PHP Using FastCGI in a Microsoft Window Environment</a>&#8220;. That post will walk you through the entire set up of IIS 7 with support for PHP running using FastCGI.<span id="more-154"></span></p><p>Setting up XDebug under Microsoft Internet Information Services(IIS) 7 is quite simple and straight forward to do. The XDebug web site is a great help in finding the proper .dll for your environment as well as supplying you instructions on getting XDebug integrated properly into your particular PHP installation. To get started you will need to copy the phpinfo() output from your system and submit it using the form on the &#8221;<a href="http://xdebug.org/find-binary.php">Tailored Installation Instructions</a>&#8221; page. After submitting the form you will be supplied a link to download the proper XDebug .dll file for your set up and will also be presented with the instructions on what to do to enable XDebug within IIS 7. The instruction you receive from the form to enable XDebug will go something like this.</p><ul><li>Download php_xdebug-&lt;replace with correct version&gt;.dll</li><li>Move the downloaded file to &#8220;C:\Program Files (x86)\PHP\v5.3\ext\</li><li>Update C:\Program Files (x86)\PHP\v5.3\php.ini and change the line<br /> zend_extension = C:\Program\php_xdebug-&lt;replace with correct version&gt;.dll</li><li>Restart the webserver</li></ul><p>You may want to however instead of only adding the single line for XDebug to the bottom of your php.ini add the following lines which supplies further settings you may need when using XDebug in conjunction with an application such as Eclipse.</p><p>[xdebug]<br /> xdebug.remote_enable=1<br /> xdebug.remote_host=&#8221;localhost&#8221;<br /> xdebug.remote_port=9000<br /> xdebug.remote_handler=&#8221;dbgp&#8221;<br /> zend_extension = C:\PHP\ext\php_xdebug-&lt;replace with correct version&gt;.dll</p> ]]></content:encoded> <wfw:commentRss>http://blog.swiftbyte.com/web-development/setting-up-xdebug-under-microsoft-internet-information-services-iis-7/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Setting Up IIS 7 and PHP Using FastCGI in a Microsoft Window Environment</title><link>http://blog.swiftbyte.com/microsoft-windows/setting-up-iis-7-and-php-using-fastcgi-in-a-microsoft-window-environment/</link> <comments>http://blog.swiftbyte.com/microsoft-windows/setting-up-iis-7-and-php-using-fastcgi-in-a-microsoft-window-environment/#comments</comments> <pubDate>Sat, 24 Sep 2011 17:22:53 +0000</pubDate> <dc:creator>Joe</dc:creator> <category><![CDATA[Microsoft Windows]]></category> <category><![CDATA[Microsoft IIS]]></category> <category><![CDATA[PHP]]></category><guid isPermaLink="false">http://blog.swiftbyte.com/?p=149</guid> <description><![CDATA[Setting up and managing PHP in a Microsoft Windows environment under Internet Information Services 7 or IIS7 is a fairly easy task when using the Microsoft Web Platform Installer. The following post will walk you through enabling the IIS 7 windows feature along with FastCGI. Afterwards we will use the Microsoft Web Platform Installer to [...]]]></description> <content:encoded><![CDATA[<p>Setting up and managing PHP in a Microsoft Windows environment under Internet Information Services 7 or IIS7 is a fairly easy task when using the Microsoft Web Platform Installer. The following post will walk you through enabling the IIS 7 windows feature along with FastCGI. Afterwards we will use the Microsoft Web Platform Installer to install PHP and the PHP Manager IIS addin. Once finished you will have IIS 7 running PHP using FastCGI as well as an easy way to enable, disable and add extensions to PHP via an easy to use GUI form within the Internet Information Services (IIS) Manager.<span id="more-149"></span></p><p>First we will need to add the IIS 7 feature to Windows by opening the Control Panel. Under &#8220;Programs and features&#8221; click on &#8220;Turn Windows Features on or off&#8221;. In the &#8220;Turn Windows features on or off&#8221; window click once on the &#8220;Internet Information Services&#8221; check box. This will select the default items needed to run IIS 7. Next expand &#8220;Internet Information Services&#8221; then expand &#8220;World Wide Web Services&#8221; then &#8220;Application Development Features&#8221;. You will then need to check the box next to &#8220;CGI&#8221; under this section in order to run PHP under FastCGI. At this time you may also with to reveiw the other features availble incase you need further support added into IIS 7 but for this post nothing else will need to be added. Once you have selected the wanted features and clicked &#8220;OK&#8221; you will have completed setting up IIS 7.</p><p><a href="http://c634250.r50.cf2.rackcdn.com/wp-content/uploads/2011/09/149-001.png"><img class="aligncenter size-medium wp-image-162" title="Turn Windows features on or off" src="http://c634250.r50.cf2.rackcdn.com/wp-content/uploads/2011/09/149-001-300x232.png" alt="Turn Windows features on or off" width="300" height="232" /></a></p><p>Once you have completed setting up IIS 7 you will now need to install PHP. In a windows environment I prefer to use the Microsoft Web Platform Installer which can be <a href="http://www.microsoft.com/web/downloads/platform.aspx" target="_blank">downloaded here</a> to acomplish this task. After installing the Microsoft Web Platform Installer run the program. A nice tool for configuring PHP in an IIS 7 environment is a tool called PHP Manager for IIS. You can download this add in using the Microsoft Web Platform Installer by doing a seach within the application for &#8220;PHP manager&#8221;. Installing this addin will install PHP for you as well so you will not have to select PHP to install as well unless you wish to use an older version of PHP. Once setup has completed you are now ready to check on your install so far from within the Internet Information Services (IIS) Manager.</p><p><a href="http://c634250.r50.cf2.rackcdn.com/wp-content/uploads/2011/09/149-002.png"><img class="aligncenter size-medium wp-image-163" title="Web Platform Installer" src="http://c634250.r50.cf2.rackcdn.com/wp-content/uploads/2011/09/149-002-300x212.png" alt="Web Platform Installer" width="300" height="212" /></a></p><p>Open the Internet Information Services (IIS) Manager from within your administrative tools folder. Expand the sites list on the left and select the site entitled &#8220;Default Web Site&#8221;. In the middle of the window under &#8220;Default Web Site Home&#8221; under the IIS heading you should find an icon for &#8220;PHP Manager&#8221;. Double click the icon to open the PHP Manager. If the manager is showing any errors or more hen likely suggestions go ahead and apply or fix them. Generally the PHP Manager will do this for you it usually just entails check marking a box or two.</p><p><a href="http://c634250.r50.cf2.rackcdn.com/wp-content/uploads/2011/09/149-003.png"><img class="aligncenter size-medium wp-image-164" title="Internet Information Services (IIS) Manager" src="http://c634250.r50.cf2.rackcdn.com/wp-content/uploads/2011/09/149-003-300x243.png" alt="Internet Information Services (IIS) Manager" width="300" height="243" /></a></p><p>To check that PHP is running properly simply click on the link under PHP Setup entitled &#8220;Check phpinfo()&#8221;. This will display all current PHP information as well as setting for all your installed extensions.</p><p>If you wish to disable any existing extensions or enable more extensions This can be done using the link &#8220;Enable or disable an extension&#8221; found under the &#8220;PHP Extentions&#8221; heading. To enable or disable extension simply select the extension in question then enable or disable them. To add an extension clcik on &#8220;Add an extension&#8221; under the same hading and browse to the extensions .dll file.</p><p><a href="http://c634250.r50.cf2.rackcdn.com/wp-content/uploads/2011/09/149-004.png"><img class="aligncenter size-medium wp-image-165" title="PHP Manager" src="http://c634250.r50.cf2.rackcdn.com/wp-content/uploads/2011/09/149-004-300x243.png" alt="PHP Manager" width="300" height="243" /></a></p><p>That is it you now have IIS 7 running with PHP using FastCGI and a simple way to manage PHP frm within the Internet Information Services (IIS) Manager.</p> ]]></content:encoded> <wfw:commentRss>http://blog.swiftbyte.com/microsoft-windows/setting-up-iis-7-and-php-using-fastcgi-in-a-microsoft-window-environment/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Configuring nginx to run Magento</title><link>http://blog.swiftbyte.com/linux/configuring-nginx-to-run-magento/</link> <comments>http://blog.swiftbyte.com/linux/configuring-nginx-to-run-magento/#comments</comments> <pubDate>Mon, 12 Sep 2011 06:23:33 +0000</pubDate> <dc:creator>Joe</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Magento]]></category> <category><![CDATA[nginx]]></category><guid isPermaLink="false">http://blog.swiftbyte.com/?p=130</guid> <description><![CDATA[The other day I moved a clients existing Magento powered ecommerce site from Apache to nginx. The following is the configuration file I used to run the application under nginx. The site is running flawlessly using this configuration and the memory drain caused by Magento under Apache seems to be somewhat less then it used to [...]]]></description> <content:encoded><![CDATA[<p>The other day I moved a clients existing Magento powered ecommerce site from Apache to nginx. The following is the configuration file I used to run the application under nginx.</p><p>The site is running flawlessly using this configuration and the memory drain caused by Magento under Apache seems to be somewhat less then it used to be meaning I am no longer having to restart the Apache httpd service as I had in the past when things got gummed up be the resource hungry application know as Magento. This configuration takes into account you will want to run Magento under both http and https so the first thing you will want to do is make sure SSL support is enabled in your nginx.conf file.<br /> <span id="more-130"></span></p><div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">    ##
    # SSL Support
    ##
&nbsp;
    map $scheme $fastcgi_https {
    default off;
        https on;
    }</pre></div></div><p>Now you will want to create your sites-available file (or virtual host file as it may be refered to) you will want to have the following text contained within this file named something like yourdomain.com. Make sure you replace your paths and domain name as well as the path to your SSL certificate file and key file with the appropriate information for your environment.</p><div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server {
    # Listen on port 80 as well as post 443 for SSL connections.
    listen 80;
    listen 443 default ssl;
&nbsp;
    server_name yourdomain.com www.yourdomain.com;
&nbsp;
    # Specify path to your SSL certificates.
    ssl_certificate /etc/nginx/certificates/yourcertificate.crt;
    ssl_certificate_key /etc/nginx/certificates/yourcertificate.key;
&nbsp;
    # Path to the files in which you wish to
    # store your access and error logs.
    access_log /path/to/your/logs/access_log;
    error_log /path/to/your/logs/error_log;
&nbsp;
    # If the site is accessed via yourdomain.com
    # automatically redirect to www.yourdomain.com.
    if ($host = 'yourdomain.com' ) {
        rewrite ^/(.*)$ http://www.yourdomain.com/$1permanent;
    }
&nbsp;
    root /path/to/magento;
&nbsp;
    location / {
        index index.html index.php;
        try_files $uri $uri/ @handler;
    }
&nbsp;
    # Deny access to specific directories no one
    # in particular needs access to anyways.
    location /app/ { deny all; }
    location /includes/ { deny all; }
    location /lib/ { deny all; }
    location /media/downloadable/ { deny all; }
    location /pkginfo/ { deny all; }
    location /report/config.xml { deny all; }
    location /var/ { deny all; }
&nbsp;
    # Allow only those who have a login name and password
    # to view the export folder. Refer to /etc/nginx/htpassword.
    location /var/export/ {
        auth_basic &quot;Restricted&quot;;
        auth_basic_user_file htpasswd;
        autoindex on;
    }
&nbsp;
    # Deny all attempts to access hidden files
    # such as .htaccess, .htpasswd, etc...
    location ~ /\. {
         deny all;
         access_log off;
         log_not_found off;
    }
&nbsp;
    # This redirect is added so to use Magentos
    # common front handler when handling incoming URLs.
    location @handler {
        rewrite / /index.php;
    }
&nbsp;
    # Forward paths such as /js/index.php/x.js
    # to their relevant handler.
    location ~ .php/ {
        rewrite ^(.*.php)/ $1 last;
    }
&nbsp;
    # Handle the exectution of .php files.
    location ~ .php$ {
        if (!-e $request_filename) {
            rewrite / /index.php last;
        }
        expires off;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_param HTTPS $fastcgi_https;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param MAGE_RUN_CODE default;
        fastcgi_param MAGE_RUN_TYPE store;
        include fastcgi_params;
    }
}</pre></div></div><p>Save this file then create a symbolic link for this file in your site-available folder.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>sites-available<span style="color: #000000; font-weight: bold;">/</span>yourdomain.com <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>sites-enabled<span style="color: #000000; font-weight: bold;">/</span>yourdomain.com</pre></div></div><p>Now restart nginx and your done. Be sure to test accessing the site via both http and https making sure when checking your https connection your SSL certificates are loading properly.</p> ]]></content:encoded> <wfw:commentRss>http://blog.swiftbyte.com/linux/configuring-nginx-to-run-magento/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Adding the ASP.NET AJAX Control Toolkit to Visual Studio</title><link>http://blog.swiftbyte.com/web-development/adding-the-asp-net-ajax-control-toolkit-to-visual-studio/</link> <comments>http://blog.swiftbyte.com/web-development/adding-the-asp-net-ajax-control-toolkit-to-visual-studio/#comments</comments> <pubDate>Sat, 10 Sep 2011 03:51:47 +0000</pubDate> <dc:creator>Joe</dc:creator> <category><![CDATA[Web Development]]></category> <category><![CDATA[ASP.NET]]></category> <category><![CDATA[ASP.NET AJAX Control Toolkit]]></category> <category><![CDATA[Visual Studio 2008]]></category> <category><![CDATA[Visual Studio 2010]]></category><guid isPermaLink="false">http://blog.swiftbyte.com/?p=112</guid> <description><![CDATA[This is an update to a quite older post that used to be on my blog. Looking over Google Analytics and Google Webmaster Tools I noticed there was still traffic coming in to view the older post and receiving a 404 error instead of the information they were looking for. So I decided to sit down [...]]]></description> <content:encoded><![CDATA[<p>This is an update to a quite older post that used to be on my blog. Looking over Google Analytics and Google Webmaster Tools I noticed there was still traffic coming in to view the older post and receiving a 404 error instead of the information they were looking for. So I decided to sit down update what I remeber to be a very outdated post going back to the Microsoft Visual Studio 2010 Beta days with a more recent up to date version including instruction for manual installation as well as installation using NuGet which wasn&#8217;t around for the original post. Anyways enough babling onto the reason you may be here which is how to add the ASP.NET AJAX Control Toolkit to both Visual Studio 2010 and Visual Studio 2008.</p><p>If you are using Visual Studio 2010 the easiest way to install the ASP.NET AJAX Control Toolkit is by using NuGet. If you are using Visual Studio 2008 you will need to follow the manual installation instructions further down this post. Of course if you are using Visual Studio 2010 you may also use the manual instructions as well if you wish.<span id="more-112"></span></p><p><strong>Installing Using NuGet: </strong>(Visual Studio 2010)</p><p>Fist off you will need to make sure you have the NuGet Package Manager installed. If you do not have NuGet installed you can download it <a href="<a href=&quot;http://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c&quot;></">here</a>. Once you have installed NuGet you have two choices as to how to install the ASP.NET AJAX Control Kit. You can install it via either the NuGet Package Manager Console or via the NuGet GUI.</p><p><em>To use the NuGet Package Manager Console</em> start Visual Studio 2010. Once Visual Studio 2010 is opened open the solution in which you wish to use the toolkit. Now that you have your solution open click on &#8221;Tools &gt; Library Package Manager &gt; Package Manager Console&#8221; at the top of Visual Studio 2010. This will open up the Package Management Console within Visual Studio 2010. Next at the Package Management Console command prompt, &#8220;PM&gt;&#8221;, type the following and press enter.</p><pre>PM&gt; Install-Package AjaxControlToolkit</pre><p>Once the Package Management Console command has completed the toolkit will have been successfully added and referenced within your solution and is ready to be used.</p><p><em>If you wish to use the NuGet GUI</em> as before start Visual Studio 2010 and open the solution in which you wish to use the tookit. Click on &#8220;Tools &gt; Library Package Manager &gt; Manage NuGet Packages&#8230;&#8221; at the top of Visual Studio 2010. Once the GUI is openclick on the &#8220;Search Online&#8221; textbox at the top right hand corner and type &#8220;ajax&#8221; then hit the enter key. Look through the list of packages found in the center of the GUI for &#8220;AjaxControlToolkit, click on it then click &#8220;Install&#8221;. The toolkit will now have been added to and referenced within your solution and is ready to be used.</p><p><strong>Installing Manually: </strong>(Visual Studio 2010 and Visual Studio 2008)</p><p>To install the ASP.NET Ajax Control Toolkit manually into either Visual Studio 2010 or Visual Studio 2008 you will fist need to download the latest version of the toolkit from the project download page which can be found <a href="http://ajaxcontroltoolkit.codeplex.com/releases/view/71000">here</a>. You will find the binary downloads for both frameworks 3.5 and 4.0 are available. Download the one you wish to use and extract the files somewhere on your hard drive remebering the path to where you extracted the files.</p><p>Next you will need to add the toolkit to your toolbar within Visual Studio. To do so right click on an empty portion of your toolbar and click on &#8220;Add Tab&#8221;. This will add a new tab to your toobar. Next name the toolbar something like &#8220;ASP.NET AJAX Control Toolkit&#8221;. Next right click on your newly created tab and click on &#8220;Choose Items..&#8221;. Make sure the &#8220;.NET Framework Components&#8221; tab is selected then click on &#8220;Browse&#8230;&#8221;. Browse to where you extracted the toolkit files to earlier and open the file named &#8220;AjaxControlToolkit.dll&#8221; then click &#8220;OK&#8221;. You should now have available to you the ASP.NET AJAX Control Toolkit controls within your Toolbox.</p> ]]></content:encoded> <wfw:commentRss>http://blog.swiftbyte.com/web-development/adding-the-asp-net-ajax-control-toolkit-to-visual-studio/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>Login and Password Security Best Practices</title><link>http://blog.swiftbyte.com/security/login-and-password-security-best-practices/</link> <comments>http://blog.swiftbyte.com/security/login-and-password-security-best-practices/#comments</comments> <pubDate>Tue, 19 Jul 2011 08:27:10 +0000</pubDate> <dc:creator>Joe</dc:creator> <category><![CDATA[Security]]></category><guid isPermaLink="false">http://blog.swiftbyte.com/?p=88</guid> <description><![CDATA[The following is a quick and dirty email I was placed in charge of sending to my current employers customer base. When writing it the email was meant to put as bluntly as possible the consequences of using weak passwords just after having two clients just this week being burnt by using passwords such as &#8220;12345&#8243; or &#8220;mydaughtersname1&#8243;. [...]]]></description> <content:encoded><![CDATA[<p>The following is a quick and dirty email I was placed in charge of sending to my current employers customer base. When writing it the email was meant to put as bluntly as possible the consequences of using weak passwords just after having two clients just this week being burnt by using passwords such as &#8220;12345&#8243; or &#8220;mydaughtersname1&#8243;. The following was the email I sent out basically using the fairly simple easy for a layman to understand guidelines found within a great document I would suggest any client of mine or visitor to this site read over released from the NSA for which the link can be located at the end of this post. The following is the email I composed.</p><p>As of late the news has been filled with stories of compromised web sites leaking personal data such as email addresses and passwords all over the Internet, some of the data even comes from multibillion dollar corporations such as in recent months Sony. To help protect yourself as well as any data stored on the Internet or locally on your network I have compiled this document regarding password policies mostly put together using the National Security Agency&#8217;s (NSA) recommendations on the matter.<span id="more-88"></span></p><p>A strong password should be at least 10 characters long and contain multiple character types including lowercase, uppercase, numbers and special characters as well as be difficult to guess. The reasoning behind this practice is to make your password as hard as possible to be revealed through someone making guesses or using software created to either brute force, attempt logins over and over with different passwords or show passwords which have been encrypted and stored within your computer or on a website whose data may have been compromised.</p><p>Login information including passwords should always be unique and never reused across multiple web sites or the same as the password used to log into your computer at work or home. This practice prevents someone who may have compromised a password on one system from gaining control of your accounts on other systems. Simply put, if login information is compromised on one site and it is the same login information used for your email account, Facebook, PayPal, Amazon.com or any other sites the chances of those accounts being compromised as well becomes highly likely and could result in serious consequences not limited to but including defamation of your name or even financial losses and identity theft. In the more recent releases of data from compromised sites most to the financial and personal damage has been a result of people gaining login information from one site and using this data to log into other sites such as PayPal and Facebook using the same login data.</p><p>Many sites make use of password recovery using a question and answer system. The answer to these questions should not be readily known by others nor be available through search engines such as Google and Bing or through public records stored on the Internet. When using systems utilizing this type of security it is best to provide false answers to these questions making sure these answers are unique across all systems just as with passwords yet something memorable to yourself. Keep in mind a mother’s maiden name is easily found through a simple search of public records and the High School you attended can be found by simply viewing your Facebook profile.</p><p>It is also a good practice to disallow programs such as web browsers from remembering and automatically entering login name and password data into a web sites login page. There are many programs available on the Internet to allow a malicious person who is able to gain direct access to your computer the ability to easily gain a list of this information stored in applications such as Internet Explorer or a Firefox plugin.</p><p>For more information on personal security on the Internet as well as learning more on how you can better secure your own personal network it is recommend that you take a look at the document from the National Security Agency entitle “Best Practices for Keeping Your Home Network Secure” which can be found at <a href="http://www.nsa.gov/ia/_files/factsheets/Best_Practices_Datasheets.pdf">http://www.nsa.gov/ia/_files/factsheets/Best_Practices_Datasheets.pdf.This</a> document not</p> ]]></content:encoded> <wfw:commentRss>http://blog.swiftbyte.com/security/login-and-password-security-best-practices/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Building Chromium OS</title><link>http://blog.swiftbyte.com/chromium-os/building-chromium-os/</link> <comments>http://blog.swiftbyte.com/chromium-os/building-chromium-os/#comments</comments> <pubDate>Sat, 02 Jul 2011 05:59:24 +0000</pubDate> <dc:creator>Joe</dc:creator> <category><![CDATA[Chromium OS]]></category><guid isPermaLink="false">http://blog.swiftbyte.com/?p=60</guid> <description><![CDATA[The following is an updated version of my step by step guide to building Chromium OS. My last post regarding this topic which I removed recently was written when the source was first released to the public. Since then steps have changed and more options were added. I based this post off the instructions supplied [...]]]></description> <content:encoded><![CDATA[<p>The following is an updated version of my step by step guide to building Chromium OS. My last post regarding this topic which I removed recently was written when the source was first released to the public. Since then steps have changed and more options were added. I based this post off the instructions supplied by the Chromium OS web site. It is basically a condenced version of their instructions which can be found at <a href="http://www.chromium.org/chromium-os/developer-guide">http://www.chromium.org/chromium-os/developer-guide</a>.</p><p>It is recommended by the Chromium OS team that you use Ubuntu 10.04 when compiling Chromium OS which is the version I used when walking through the build myself. Also for this step by step walkthrough I am also running all commands unless specified starting from my user home directory.<span id="more-60"></span></p><p>The first step will be to download depot_tools. These tools are required for getting and syncing the current Chromium OS source code. The commands you will need to run to do so are as follows.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> subversion
<span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> http:<span style="color: #000000; font-weight: bold;">//</span>src.chromium.org<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>tools<span style="color: #000000; font-weight: bold;">/</span>depot_tools <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=<span style="color: #800000;">${HOME}</span><span style="color: #000000; font-weight: bold;">/</span>depot_tools:<span style="color: #ff0000;">&quot;<span style="color: #007800;">$PATH</span>&quot;</span></pre></div></div><p>Next we will need to install Git. To do so run the following commands.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> git-core gitk git-gui
<span style="color: #c20cb9; font-weight: bold;">git</span> config <span style="color: #660033;">--global</span> user.email <span style="color: #ff0000;">&quot;you@example.com&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">git</span> config <span style="color: #660033;">--global</span> user.name <span style="color: #ff0000;">&quot;Your Name&quot;</span></pre></div></div><p>Next we will need to make our source directory. Feel free to place this directory in a difrent location if you like but in order to more easily follow this walkthrough I suggest that if you do so you create a symbolic link to chromiumos in your home directory from where we are working from.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #800000;">${HOME}</span><span style="color: #000000; font-weight: bold;">/</span>chromiumos</pre></div></div><p>Now it is time to get the latest source code. Run the following commands to allow connections to git and then using the depot tools we installed earlier get the latest version of the source code.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-p</span> <span style="color: #000000;">29418</span> gerrit.chromium.org
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #800000;">${HOME}</span><span style="color: #000000; font-weight: bold;">/</span>chromiumos
repo init <span style="color: #660033;">-u</span> http:<span style="color: #000000; font-weight: bold;">//</span>git.chromium.org<span style="color: #000000; font-weight: bold;">/</span>chromiumos<span style="color: #000000; font-weight: bold;">/</span>manifest.git
repo <span style="color: #c20cb9; font-weight: bold;">sync</span></pre></div></div><p>We will now need to create a chroot inwhich we will do our work. The ./make_chroot command may take awhile to finish while it downloads compiles and moves around the tools needed to build Chromium OS.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> src<span style="color: #000000; font-weight: bold;">/</span>scripts
.<span style="color: #000000; font-weight: bold;">/</span>make_chroot
.<span style="color: #000000; font-weight: bold;">/</span>enter_chroot.sh</pre></div></div><p>After running ./enter_chroot.sh you should be at a command prompt which looks something like this.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#40;</span>should see <span style="color: #7a0874; font-weight: bold;">&#40;</span>cr<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>26d68ec...<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> joe<span style="color: #000000; font-weight: bold;">@</span>ubuntu ~<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>scripts $<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div><p>Next we will need to initialize the build for a chosen board type. You will need to choose the board type depending on the processor type you are building Chromium OS for. Choose board type you wish to compile for and run ONE of the following two commands to store your chosen board type within your environment for referance through the rest of the build.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">BOARD</span>=x86-generic
<span style="color: #007800;">BOARD</span>=arm-generic</pre></div></div><p>Now initialize the chosen board with the following command.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>setup_board <span style="color: #660033;">--board</span>=<span style="color: #800000;">${BOARD}</span></pre></div></div><p>It is now time to set the chronos password. The chronos account is the &#8220;root&#8221; or &#8220;sudo&#8221; access for the system and is the account you will need to log in with in order to get command line access to the system.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>set_shared_user_password.sh</pre></div></div><p>It is now time to build the packages for the chosen board. The following command will download any needed files to build the packages, nearly 3GB on your first build as well as build any packages not available in binary form. This portion of the build may take awhile to complete depending on your connection and computer speed.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>build_packages <span style="color: #660033;">--board</span>=<span style="color: #800000;">${BOARD}</span> <span style="color: #660033;">--oldchromebinary</span></pre></div></div><p>Now we need to build the image by running the following command.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>build_image <span style="color: #660033;">--board</span>=<span style="color: #800000;">${BOARD}</span> <span style="color: #660033;">--withdev</span> --noenable_rootfs_verification</pre></div></div><p>After the build has been completed it is now time to create our disk image. You have a few choices here either build a virtual machine image, bootable USB image or install directly to a Chrome OS notebook. I will not cover the installation to a Chrome OS notebook due to the fact I do not have one to test the steps out on.</p><p>To build a virtual machine image choose one of the following commands depending on the virtual machine environment you wish to run the image under. If you wish to create a USB image skip this step.</p><p>qemu</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>image_to_vm.sh <span style="color: #660033;">--board</span>=<span style="color: #800000;">${BOARD}</span></pre></div></div><p>VMware</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>image_to_vm.sh <span style="color: #660033;">--board</span>=<span style="color: #800000;">${BOARD}</span> <span style="color: #660033;">--format</span>=vmware</pre></div></div><p>Virtualbox</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>image_to_vm.sh <span style="color: #660033;">--board</span>=<span style="color: #800000;">${BOARD}</span> <span style="color: #660033;">--format</span>=virtualbox</pre></div></div><p>To build a USB image you will run the following command.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>image_to_usb.sh <span style="color: #660033;">--board</span>=<span style="color: #800000;">${BOARD}</span></pre></div></div><p>You may specify a specific USB drive to send the image to by specifying the device it is running under such as /dev/sdc by adding the &#8211;to= flag followed by the location of the device as well.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>image_to_usb.sh <span style="color: #660033;">--board</span>=<span style="color: #800000;">${BOARD}</span> <span style="color: #660033;">--to</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdc</pre></div></div><p>You should now have a functioning virtual machine or bootable USB image of Chromium OS. Simply boot up your virtual machine using your chosen virtual machine software or boot directly to your USB drive if that was the type of medium you chose to run Chromium OS from.</p> ]]></content:encoded> <wfw:commentRss>http://blog.swiftbyte.com/chromium-os/building-chromium-os/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Configuring nginx to run WordPress</title><link>http://blog.swiftbyte.com/linux/configuring-nginx-to-run-wordpress/</link> <comments>http://blog.swiftbyte.com/linux/configuring-nginx-to-run-wordpress/#comments</comments> <pubDate>Sat, 02 Jul 2011 00:47:03 +0000</pubDate> <dc:creator>Joe</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[nginx]]></category> <category><![CDATA[WordPress]]></category><guid isPermaLink="false">http://blog.swiftbyte.com/?p=67</guid> <description><![CDATA[This post is about configuring nginx to run wordpress. The actual setup of WordPress remains the same as with any other server so I will not cover that in this post. For instruction on how to setup WordPress I suggest reading the documentation regarding WordPress installation contained within the WordPress Codex at http://codex.wordpress.org/Installing_WordPress. The main [...]]]></description> <content:encoded><![CDATA[<p>This post is about configuring nginx to run wordpress. The actual setup of WordPress remains the same as with any other server so I will not cover that in this post. For instruction on how to setup WordPress I suggest reading the documentation regarding WordPress installation contained within the WordPress Codex at <a href="http://codex.wordpress.org/Installing_WordPress">http://codex.wordpress.org/Installing_WordPress</a>.</p><p>The main difference between running WordPress on a server such as Apache is how the rewrites work. below is a working configuration which runs WordPress flawlessly using nginx which I use. This nginx site configuration file should reside in your /etc/nginx/sites-available/ folder. Be sure to change the paths within this configuration to reflect your paths to WordPress and log files. Once this configuration file is in place and linked to your sites-enabled folder restart your nginx process and you should be good to go with full support for WordPress&#8217;es Permalinks.<span id="more-67"></span></p><div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server {
    listen 80;
    server_name yourdomain.com www.yourdomain.com;
&nbsp;
    # If the site is accessed via yourdomain.com
    # automatically redirect to www.yourdomain.com.
    if ($host = yourdomain.com' ) {
        rewrite  ^/(.*)$  http://www.yourdomain.com/$1  permanent;
    }
&nbsp;
    access_log  /path/to/your/logs/access_log;
    error_log /path/to/your/logs/error_log;
&nbsp;
    root   /path/to/wordpress;
    index  index.php index.html index.htm;
&nbsp;
    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }
&nbsp;
    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }
&nbsp;
    # Deny all attempts to access hidden files
    # such as .htaccess, .htpasswd, etc...
    location ~ /\. {
        deny all;
        access_log off;
        log_not_found off;
    }
&nbsp;
    # Begin WordPress specific items.
    location / {
        try_files $uri $uri/ /index.php?$args;
    }
&nbsp;
    rewrite /wp-admin/$ /wp-admin/index.php last;
    # End WordPress specific items.
&nbsp;
    location ~ \.php$ {
        root   /path/to/wordpress;
&nbsp;
        # Security against php processing files of
        # the same name but diffrent extentions.
        if (!-f $request_filename) {
            return 404;
        }
&nbsp;
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        include  fastcgi_params;
    }
}</pre></div></div>]]></content:encoded> <wfw:commentRss>http://blog.swiftbyte.com/linux/configuring-nginx-to-run-wordpress/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Allowing SFTP access while chrooting the user and denying shell access.</title><link>http://blog.swiftbyte.com/linux/allowing-sftp-access-while-chrooting-the-user-and-denying-shell-access/</link> <comments>http://blog.swiftbyte.com/linux/allowing-sftp-access-while-chrooting-the-user-and-denying-shell-access/#comments</comments> <pubDate>Wed, 29 Jun 2011 00:49:23 +0000</pubDate> <dc:creator>Joe</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[SFTP]]></category><guid isPermaLink="false">http://blog.swiftbyte.com/?p=46</guid> <description><![CDATA[In my opinion File Transfer Protocol (FTP) is a dated protocol which no administrator in their right mind should ever allow to run on any server they are in charge of administrating. FTP was never a protocol designed to be secure and just as Telnet to access remote servers was replaced long ago so should [...]]]></description> <content:encoded><![CDATA[<p>In my opinion File Transfer Protocol (FTP) is a dated protocol which no administrator in their right mind should ever allow to run on any server they are in charge of administrating. FTP was never a protocol designed to be secure and just as Telnet to access remote servers was replaced long ago so should FTP. I will not go into the many weaknesses of FTP security wise when used over the Internet but I am sure if you are reading this you already understand there is a huge risk allowing such a protocol to run on any of your systems.</p><p>There are a few solutions to FTP&#8217;s shortcomings when it comes to security such as FTPS and SFTP. In this post I will cover SSH File Transfer Protocol or SFTP. SFTP allows for secure file access, transfer and management over SSH which most Linux servers generally have installed to allow for remote administration.</p><p>By default any account with SSH access already has SFTP access as well. The problem with just adding a user and letting them have at it is that by default along with SFTP access users which you only wish to grant file management access also have shell access and may be able to install and run processes you may not wish them to run on your server. The following is a command by command walk through on how to allow users only file management access via SFTP while not allowing them to gain shell access on your server.<span id="more-46"></span></p><p>These command by command instructions are Ubuntu/Debian centric but only with the in the case of apt-get and process restart commands and should be no problem to adapt to any other distro. The first thing we will want to do is install SSH which generally is installed by default but just in case&#8230;</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> openssh-server</pre></div></div><p>Once we know SSH is installed we can then begin to add users we wish to allow only SFTP access only to. We will start by adding a new user group to our system. I will use &#8220;sftponly&#8221; for the name of this group but the name of the group is up to you. Just be sure that if you use a different name to modify any proceeding referances to the &#8220;sftponly&#8221; group name with the one you used.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> groupadd sftponly</pre></div></div><p>Now open the file /etc/ssh/sshd_config in your favorite text edit. I prefer nano for such trivial edits.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssh<span style="color: #000000; font-weight: bold;">/</span>sshd_config</pre></div></div><p>Look for the line near the bottom of this file that looks like this.</p><div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Subsystem sftp /usr/lib/openssh/sftp-server</pre></div></div><p>And change it to this.</p><div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Subsystem sftp internal-sftp</pre></div></div><p>At the very bottom of this file you will need to add the following lines which restrict the &#8220;sftponly&#8221; user groups access when logging in via SSH.</p><div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># Rules for sftponly group
Match group sftponly
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp</pre></div></div><p>Once you have added these lines save the file and restart the SSH process.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ssh</span> restart</pre></div></div><p>Next we will create the home directory for the user we are about to add where they will be allowed file access to as well as where they will be chrooted or jailed. This directory can be located wherever but for the sake of this tutorial I will use the following directory.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhost<span style="color: #000000; font-weight: bold;">/</span>domain.com<span style="color: #000000; font-weight: bold;">/</span></pre></div></div><p>Now we will need to add a user as we normally would under Linux. At this time we will also specify the users home directory which we just created using the &#8220;-d&#8221; flag. Remember to replace &#8220;sally&#8221; with the login name for the user you wish to add.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> useradd <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhosts<span style="color: #000000; font-weight: bold;">/</span>domain.com<span style="color: #000000; font-weight: bold;">/</span> sally</pre></div></div><p>Then we will need to change the group which the user we just added will belong to.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> usermod <span style="color: #660033;">-g</span> sftponly sally</pre></div></div><p>Next we will set our new user&#8217;s shell to /bin/false which will not allowing our new user shell login.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> usermod <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">false</span> sally</pre></div></div><p>We will now need to give ownership to any files and folders within the new users home directory which may exist such as folders brought over from a skel or created by an administrator setting up the users home directory manually.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> sally:sftponly <span style="color: #660033;">-R</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhosts<span style="color: #000000; font-weight: bold;">/</span>domain.com<span style="color: #000000; font-weight: bold;">/</span></pre></div></div><p>Now comes an important part the newly created users home directory MUST be owned by root. If this directory is not owned by root then the newly created user may not be chooted or jailed within their home directory possibly allowing them access to other directories under theirs.</p><div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> root:root <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>vhosts<span style="color: #000000; font-weight: bold;">/</span>domain.com<span style="color: #000000; font-weight: bold;">/</span></pre></div></div><p>And that is it you now have set up a user allowed only SFTP access over SSH with no shell access and chroot them within their directory. You are now much safer then you were when running FTP.</p> ]]></content:encoded> <wfw:commentRss>http://blog.swiftbyte.com/linux/allowing-sftp-access-while-chrooting-the-user-and-denying-shell-access/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc
Page Caching using apc
Database Caching 1/47 queries in 0.032 seconds using apc
Object Caching 666/781 objects using apc
Content Delivery Network via Rackspace Cloud Files: c634250.r50.cf2.rackcdn.com

Served from: blog.swiftbyte.com @ 2012-05-18 12:31:03 -->
