<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>

  var _gaq = _gaq || [];
  _gaq.push([‘_setAccount’, ‘UA-9965501-1’]);
  _gaq.push([‘_trackPageview’]);

  (function() {
    var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
    ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
  })();</description><title>Psyko Cybernetik</title><generator>Tumblr (3.0; @psykocybernetik)</generator><link>http://psykocybernetik.com/</link><item><title>Drupal Inline Popup Reference Field</title><description>&lt;p&gt;It seems that I am spending some time learning  Drupal so the content of this post may defer from the editorial line a  bit but as usual, I hope it may help someone.&lt;/p&gt;
&lt;p&gt;The current drupal installation I am working with has &lt;a href="http://drupal.org/project/cck"&gt;CCK&lt;/a&gt; and &lt;a href="http://drupal.org/project/popups_reference"&gt;Popups: Add and Reference&lt;/a&gt; (let&amp;#8217;s call it PAR for future (shorter) references) modules.  Unfortunately, by default the links added by PAR are in a new div tag  below the input fields which increase the length of the form quite a bit  as you can see below.&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img alt="PAR - Links under input field" src="http://media.tumblr.com/tumblr_l6u51hloNm1qcbewf.png" align="middle"/&gt;&lt;/p&gt;
&lt;p&gt;What I am proposing here is a way to put the PAR links inline with  the input field. I am quite a beginner with Drupal so the method may not  be really clean or fail proof and your comments about any easier way of  doing it are welcomed. The result looks like the screenshot below.&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img alt="PAR - Span inline tag" src="http://media.tumblr.com/tumblr_l6u52zIyVH1qcbewf.png" align="middle"/&gt;&lt;/p&gt;
&lt;p&gt;In order to get to the result, I had to modify the following files:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;the module file: popups_reference.module&lt;/li&gt;
&lt;li&gt;the template file of my theme: template.php&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;In the popups_reference.module file (that is located under &lt;code&gt;sites/all/modules/popups_reference&lt;/code&gt;), I have modified the function &lt;code&gt;popups_reference_alter_item(&amp;amp;$form, $key, $item, $fields)&lt;/code&gt; in order to remove the link addition from the &lt;code&gt;$form[$key]['#suffix']&lt;/code&gt;. Instead, I am putting the links in an array that is used later by the post_render function.&lt;/p&gt;
&lt;p&gt;The post_render function is actually looking for some string that I  have added in the template.php and is replacing it if needed, i.e. if  there is a PAR link to output. Let&amp;#8217;s take at what was done in the  template.php file (located under &lt;code&gt;sites/all/themes/MYTHEME&lt;/code&gt; (where MYTHEME is to be replaced by the appropriate name, i.e. your theme name)). &lt;/p&gt;
&lt;p&gt;In the template.php, I override the &lt;a href="http://api.drupal.org/api/function/theme_form_element/6"&gt;form_element function&lt;/a&gt; that is used to display the field titles, description and input. You  can see the complete function here under, but the only addition is the  following line after the value is added to the &lt;code&gt;$output&lt;/code&gt; variable.&lt;/p&gt;
&lt;pre&gt;  $output .= "&amp;lt;span class=\"popups-reference-link\"/&amp;gt;\n";&lt;br/&gt;&lt;/pre&gt;
&lt;pre&gt;/**&lt;br/&gt; * Function used to overwrite the default display of form elements.&lt;br/&gt; * The description tag is placed before the input tag&lt;br/&gt; * A span tag for the popups_reference module has been added before the final div. &lt;br/&gt; * It allows to have the links created by the popups_reference module inline with the input field.&lt;br/&gt; */&lt;br/&gt;function NewsFlash_form_element($element, $value) {&lt;br/&gt;  $output  = '&amp;lt;div class="form-item"';&lt;br/&gt;  if (!empty($element['#id'])) {&lt;br/&gt;    $output .= ' id="'. $element['#id'] .'-wrapper"';&lt;br/&gt;  }&lt;br/&gt;  $output .= "&amp;gt;\n";&lt;br/&gt;  $required = !empty($element['#required']) ? '&amp;lt;span class="form-required" title="'. t('This field is required.') .'"&amp;gt;*&amp;lt;/span&amp;gt;' : '';&lt;br/&gt;&lt;br/&gt;  if (!empty($element['#title'])) {&lt;br/&gt;    $title = $element['#title'];&lt;br/&gt;    if (!empty($element['#id'])) {&lt;br/&gt;      $output .= ' &amp;lt;label for="'. $element['#id'] .'"&amp;gt;'. t('!title: !required', array('!title' =&amp;gt; filter_xss_admin($title), '!required' =&amp;gt; $required)) ."&amp;lt;/label&amp;gt;\n";&lt;br/&gt;    }&lt;br/&gt;    else {&lt;br/&gt;      $output .= ' &amp;lt;label&amp;gt;'. t('!title: !required', array('!title' =&amp;gt; filter_xss_admin($title), '!required' =&amp;gt; $required)) ."&amp;lt;/label&amp;gt;\n";&lt;br/&gt;    }&lt;br/&gt;  }&lt;br/&gt;&lt;br/&gt;  $output .= " $value\n";&lt;br/&gt;&lt;br/&gt;  // Add a span tag that will be replaced if necessary when the popups_reference &lt;br/&gt;  // module adds links to create new node.&lt;br/&gt;  $output .= "&amp;lt;span class=\"popups-reference-link\"/&amp;gt;\n";&lt;br/&gt;&lt;br/&gt;  if (!empty($element['#description'])) {&lt;br/&gt;    $output .= ' &amp;lt;div class="description"&amp;gt;'. $element['#description'] ."&amp;lt;/div&amp;gt;\n";&lt;br/&gt;  }&lt;br/&gt;&lt;br/&gt;  $output .= "&amp;lt;/div&amp;gt;\n";&lt;br/&gt;&lt;br/&gt;  return $output;&lt;br/&gt;}&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;And that&amp;#8217;s it to display the &amp;#8220;Add New: Add XXX&amp;#8221; link inline with the input or select field.&lt;/p&gt;
&lt;p&gt;I have attached the modified popups_reference.module and my template.php  to this post. If you have any comment regarding a better way to do  that, I&amp;#8217;d be glad to know, so feel free to drop a comment.&lt;/p&gt;
&lt;pre&gt;&amp;lt;?php&lt;br/&gt;// $Id: popups_reference.module,v 1.1.2.12 2009/03/07 06:54:25 starbow Exp $&lt;br/&gt;&lt;br/&gt;/**&lt;br/&gt; * @file&lt;br/&gt; * Modify the Node Reference widget to use a popup to add a new node.&lt;br/&gt; */ &lt;br/&gt;&lt;br/&gt;$links_replacement;&lt;br/&gt;&lt;br/&gt;/**&lt;br/&gt; * Implementation of hook_form_alter().&lt;br/&gt; * &lt;br/&gt; * Modifies the nodereference setting form and the basic node form. &lt;br/&gt; */&lt;br/&gt;function popups_reference_form_alter(&amp;amp;$form, $form_state, $form_id) {&lt;br/&gt;  if ($form_id == 'content_field_edit_form' &amp;amp;&amp;amp; $form['#field']['type'] == 'nodereference') {&lt;br/&gt;    // Add a checkbox to the nodereference settings page.&lt;br/&gt;    $field_name = $form['#field']['field_name'];&lt;br/&gt;    $form['field']['show_add_link'] = array(&lt;br/&gt;    '#type' =&amp;gt; 'checkbox',&lt;br/&gt;      '#default_value' =&amp;gt; variable_get('popups_reference_show_add_link_'. $field_name, TRUE),&lt;br/&gt;      '#title' =&amp;gt; t('Show the "Add New: Node Type" Popup links'),&lt;br/&gt;      '#description' =&amp;gt; t("Activate Popups:Add and Reference behavior for this reference.")&lt;br/&gt;    );&lt;br/&gt;    $form['#submit'][] = '_popups_reference_manage_fields_submit';&lt;br/&gt;  }&lt;br/&gt;  elseif (isset($form['type'])) {&lt;br/&gt;    // Add the "Add New: Node Type" links.&lt;br/&gt;    $node = $form['#node'];&lt;br/&gt;    if ($form['type']['#value'] .'_node_form' == $form_id) {  &lt;br/&gt;      $fields = content_fields();&lt;br/&gt;      foreach ($form as $key =&amp;gt; $item) {&lt;br/&gt;        if (is_array($item)) {&lt;br/&gt;          $type = $item['#type'];&lt;br/&gt;          if ($type == 'fieldset') { // Loop through all the subitems.&lt;br/&gt;            foreach ($form[$key] as $subkey =&amp;gt; $subitem) {&lt;br/&gt;              popups_reference_alter_item($form[$key], $subkey, $subitem, $fields);&lt;br/&gt;            }&lt;br/&gt;          }&lt;br/&gt;          else {&lt;br/&gt;            popups_reference_alter_item($form, $key, $item, $fields);&lt;br/&gt;          }&lt;br/&gt;        }&lt;br/&gt;&lt;br/&gt;      }&lt;br/&gt;    }&lt;br/&gt;  }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;/**&lt;br/&gt; * Implementation of hook_nodeapi().&lt;br/&gt; * Add cookies with node info when a new node is created.&lt;br/&gt; * These cookies will be found by the popups_reference behavior and used&lt;br/&gt; *   to select the newly created node in the reference widget.&lt;br/&gt; */ &lt;br/&gt;function popups_reference_nodeapi($node, $op) {&lt;br/&gt;  if ($op == 'insert') {&lt;br/&gt;      $five = time()+300; // 5 minutes in the future.&lt;br/&gt;      setcookie("PopupRefNid", $node-&amp;gt;nid, $five, '/'); &lt;br/&gt;//      setcookie("PopupRefTitle", $node-&amp;gt;title, $five, '/');&lt;br/&gt;      setrawcookie("PopupRefTitle", rawurlencode($node-&amp;gt;title), $five, '/');&lt;br/&gt;  }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;/**&lt;br/&gt; * Submit added to the the nodereference settings form.&lt;br/&gt; * Set a variable for each nodereference field.&lt;br/&gt; */&lt;br/&gt;function _popups_reference_manage_fields_submit($form, &amp;amp;$form_state) {&lt;br/&gt;  $field_name = $form['#field']['field_name'];&lt;br/&gt;  variable_set('popups_reference_show_add_link_'. $field_name, $form_state['values']['show_add_link']);&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;/**&lt;br/&gt; * Run on every element in the basic node form.&lt;br/&gt; * Wrap the enabled nodereference fields, and add the popup links.&lt;br/&gt; *&lt;br/&gt; * @param $form - the form (or fieldgroup).&lt;br/&gt; * @param $key - form element name.&lt;br/&gt; * @param $item - the form element array.&lt;br/&gt; * @param $fields - all fields info.&lt;br/&gt; */&lt;br/&gt;function popups_reference_alter_item(&amp;amp;$form, $key, $item, $fields) {  &lt;br/&gt;  $field_name = strstr($key, 'field_'); // Check if $key starts with 'field_';&lt;br/&gt;  if (isset($fields[$field_name]) &amp;amp;&amp;amp; &lt;br/&gt;      $fields[$field_name]['type'] == 'nodereference' &amp;amp;&amp;amp;&lt;br/&gt;      variable_get('popups_reference_show_add_link_'. $field_name, TRUE)) {&lt;br/&gt;    $type = $form['type']['#value'];&lt;br/&gt;    $field = content_fields($field_name, $type);&lt;br/&gt;    $wrapper_id = 'popups-reference-' . _popups_reference_counter();&lt;br/&gt;    $links = _popups_reference_links($field, $type, $wrapper_id, $field['widget']['type']);&lt;br/&gt;    if ($links) {&lt;br/&gt;      // Put the nodereference widget and links in an wpopups link cssrapper.&lt;br/&gt;      // Makes it easy to find for Ahah targeting, and popups_reference behavior selecting.&lt;br/&gt;      global $links_replacement;&lt;br/&gt;      // Register the links into the global array. Key is the field name so that we can identify the &lt;br/&gt;      // correct element in the post_render method&lt;br/&gt;      $links_replacement[$field_name] = implode(', ', $links);&lt;br/&gt;      // Set prefix and suffix&lt;br/&gt;      $form[$key]['#prefix'] = '&amp;lt;div id="'. $wrapper_id .'"&amp;gt;';&lt;br/&gt;      $form[$key]['#suffix'] = '&amp;lt;/div&amp;gt;';&lt;br/&gt;      // Set the post render method that will be called when the variable are rendered&lt;br/&gt;      $form[$key]['#post_render'] = array('cck_field_post_render_popups_reference_link');&lt;br/&gt;    }&lt;br/&gt;  }&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;// Post_render method&lt;br/&gt;function cck_field_post_render_popups_reference_link($content, $element){&lt;br/&gt;	global $links_replacement;	&lt;br/&gt;	//dsm($element);&lt;br/&gt;	foreach(	$links_replacement as $field_name =&amp;gt; $links) {&lt;br/&gt;		// If the content contains the field_name, then we can display the links&lt;br/&gt;		if(strstr($content, $field_name)){&lt;br/&gt;			$tag_to_replace = "&amp;lt;span class=\"popups-reference-link\"/&amp;gt;";&lt;br/&gt;			$replacing_tag_prefix = '&amp;lt;span class="popups-reference-link"&amp;gt; Créer: ';&lt;br/&gt;			$replacing_tag_suffix = '&amp;lt;/span&amp;gt;';&lt;br/&gt;			// If the type of nodereference is an input or a select, then we can replace all (i.e. the only one) span tag existing&lt;br/&gt;			if ($element['#type'] != 'nodereference_buttons'){&lt;br/&gt;				$content = str_replace($tag_to_replace, $replacing_tag_prefix . $links . $replacing_tag_suffix, $content);&lt;br/&gt;			}&lt;br/&gt;			// If the type of nodereference is a list of checkboxes, then we replace only the last span tag&lt;br/&gt;			// i.e the tag that appears after all the checkboxes&lt;br/&gt;			else {&lt;br/&gt;				$last_occurrence = strrpos($content, $tag_to_replace);&lt;br/&gt;				$content = substr_replace($content, $replacing_tag_prefix . $links . $replacing_tag_suffix, $last_occurrence, $last_occurrence + strlen($tag_to_replace) - strlen($content));&lt;br/&gt;			}		&lt;br/&gt;		}&lt;br/&gt;	}&lt;br/&gt;	return $content;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;/**&lt;br/&gt; * Generates 'Add new...' link&lt;br/&gt; * for each allowed content type&lt;br/&gt; *&lt;br/&gt; * @param $field&lt;br/&gt; * @param $src_type - the type of base node.&lt;br/&gt; * @param $wrapper_id - id for the wrapper around the node reference.&lt;br/&gt; * @param $type - the type of widget.&lt;br/&gt; * @return Array of html links.&lt;br/&gt; */&lt;br/&gt;function _popups_reference_links($field, $src_type, $wrapper_id, $widget_type) {&lt;br/&gt;  if ($widget_type == 'nodereference_select' || $widget_type == 'nodereference_buttons') { &lt;br/&gt;    // Target the wrapper for replacing.&lt;br/&gt;    popups_add_popups(array('a.'.$wrapper_id=&amp;gt;array('targetSelectors'=&amp;gt;array('#'.$wrapper_id))));&lt;br/&gt;  }&lt;br/&gt;  else if ($widget_type == 'nodereference_autocomplete') { &lt;br/&gt;    // Don't replace the autocomplete when done.&lt;br/&gt;    popups_add_popups(array('a.'.$wrapper_id=&amp;gt;array('noUpdate'=&amp;gt;TRUE)));&lt;br/&gt;  }&lt;br/&gt;  else { // Unsupported type.&lt;br/&gt;    return;&lt;br/&gt;  }&lt;br/&gt;  $options = array(&lt;br/&gt;    'attributes' =&amp;gt; array(&lt;br/&gt;      'class' =&amp;gt; $wrapper_id . ' popups-reference', &lt;br/&gt;      'rel' =&amp;gt; $wrapper_id,&lt;br/&gt;  ),&lt;br/&gt;    'query' =&amp;gt; array('destination' =&amp;gt; 'node/add/' . str_replace('_', '-', $src_type)),  &lt;br/&gt;  );&lt;br/&gt;  $links = array();&lt;br/&gt;  $all_types = node_get_types();&lt;br/&gt;  foreach ($field['referenceable_types'] as $add_type =&amp;gt; $value) {&lt;br/&gt;    if (!empty($value) &amp;amp;&amp;amp; (user_access("create $add_type content") || user_access('administer nodes'))) {&lt;br/&gt;    //if (!empty($value) &amp;amp;&amp;amp; user_access("create $add_type content")) {&lt;br/&gt;      drupal_add_js(drupal_get_path('module', 'popups_reference') .'/popups_reference.js');&lt;br/&gt;      $path = 'node/add/' . str_replace('_', '-', $add_type);&lt;br/&gt;      $name = $all_types[$add_type]-&amp;gt;name;&lt;br/&gt;      $links[] = l(" $name", $path, $options);&lt;br/&gt;    }&lt;br/&gt;  }&lt;br/&gt;  return $links;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;/**&lt;br/&gt; * A counter for generating unique element id's.&lt;br/&gt; *&lt;br/&gt; * @return int: next integer.&lt;br/&gt; */&lt;br/&gt;function _popups_reference_counter() {&lt;br/&gt;  static $count = 0;&lt;br/&gt;  return $count++;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;span class='\"popups-reference-link\"/'&gt;&lt;/span&gt;&lt;/pre&gt;</description><link>http://psykocybernetik.com/post/909504537</link><guid>http://psykocybernetik.com/post/909504537</guid><pubDate>Wed, 07 Oct 2009 22:36:00 +0200</pubDate><category>drupal</category><category>popup</category></item><item><title>Drupal Private Download Folder</title><description>&lt;p&gt;Still  working with Drupal and still learning a lot&amp;#8230; The challenge I was  facing was to let users upload files to a specific folder but to  restrict access to that file so that it cannot be downloaded by anybody  simply by giving the file path (private download). Therefore, users are  allowed to post content but not access it (otherwise nothing prevent  them to access files from other users in the folders).&lt;/p&gt;
&lt;p&gt;Fortunately - as often with Drupal - there are already solutions on the web:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;&lt;a title="http://www.drupalcoder.com/story/406-mixing-private-and-public-downloads-in-drupal-6" href="http://www.drupalcoder.com/story/406-mixing-private-and-public-downloads-in-drupal-6"&gt;&lt;a href="http://www.drupalcoder.com/story/406-mixing-private-and-public-downloads..."&gt;http://www.drupalcoder.com/story/406-mixing-private-and-public-downloads&amp;#8230;&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a title="http://drupal.org/node/540754" href="http://drupal.org/node/540754"&gt;&lt;a href="http://drupal.org/node/540754"&gt;http://drupal.org/node/540754&lt;/a&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;To summarize, I mixed the two solutions given here above, because I  had a problem when using only solution 1 (my drupal site is not at the  root of the website but in a subfolder). Therefore I used method 2 and  edited the .htaccess file at the root of the website in order to add the  following line somewhere in the block delimited by &lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;...&amp;lt;/IfModule&amp;gt;&lt;/code&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;RewriteRule ^sites\/default\/files\/(protected_download_dir\/.*)$ index.php?q=system/files/$1&lt;/code&gt;&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;For what I have noticed, it is also possible to edit put the line as&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;RewriteRule ^sites\/default\/files\/(protected_download_dir\/.*)$ /system/files/$1&lt;/code&gt;&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;but maybe one is better than the other.&lt;/p&gt;
&lt;p&gt;After that, I just implemented the private download module given in &lt;a href="http://www.drupalcoder.com/story/406-mixing-private-and-public-downloads-in-drupal-6#comment-339"&gt;one of the comment&lt;/a&gt; of the first link. As a result, the following is now the current flow:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Some users are allowed to create a custom content containing a CCK  filefield item so that they can upload a file in the private folder&lt;/li&gt;
&lt;li&gt;Once the file is uploaded, normal users do not have the permission to access the file&lt;/li&gt;
&lt;li&gt;Administrators receive a email that a new content containing a file has been uploaded&lt;/li&gt;
&lt;li&gt;Administrator with the privatedownload permission (part of the  module) are allowed to access the file in the private folder and  therefore allowed to download it&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Note that as mentioned in the links above, this solution offers one  private folder that would be like a pool in which user can throw their  files but not access them. Only administrators are allowed to access the  files. It is therefore easier if all files are situated in this unique  folder so that administrators can retrieve / remove all files at once  (by ftp/sftp/ssh) if necessary.&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909490110</link><guid>http://psykocybernetik.com/post/909490110</guid><pubDate>Wed, 26 Aug 2009 23:16:00 +0200</pubDate><category>drupal</category></item><item><title>Share Firefox Profile Between Computers</title><description>&lt;p&gt;It is no secret, it is easy to share a firefox profile. I am running a &lt;a target="_self" href="http://psykocybernetik.tumblr.com/post/909473837/install-linux-mint-lenovo-x200"&gt;dual boot Linux / Windows&lt;/a&gt; and was therefore interested to share my Firefox profile between the  two. But in the process, I actually became interested to be able to  access that profile from my work computer. After all, there are already  extensions to store bookmarks remotely so why not do the same with the  complete profile.&lt;/p&gt;
&lt;p&gt;This is the reason why I decided to create a new profile on my &lt;a href="http://www.getdropbox.com/"&gt;Dropbox&lt;/a&gt;.  That way, the profile is stored remotely and synchronized in real-time  between my work computer and my personal computer (both Linux and  Windows).&lt;/p&gt;
&lt;p&gt;Creating a new profile can be done in two ways. The first is by using  the graphical interface and the second is by modifying the profiles.ini  file directly. I will present both.&lt;/p&gt;
&lt;h3&gt;Add a profile with UI&lt;/h3&gt;
&lt;p&gt;To access the profile manager,&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Under Linux: Open a console and type &amp;#8220;firefox -profilemanager&amp;#8221; (without the &amp;#8220;&amp;#8221;)&lt;br/&gt;&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u5xi3QoT1qcbewf.png"/&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;Under Windows: Open a command line (Windows+R), navigate to the  firefox folder (cd C:\Program Files\Mozilla Firefox), and type &amp;#8220;firefox  -profilemanager&amp;#8221;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;This will open the profile manager window that should look like the  following. In here, simply click the &amp;#8220;Create Profile&amp;#8230;&amp;#8221; button.&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u5ylI2Je1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p class="rteleft"&gt;The new windows allows to specify the folder where you want to store the profile.&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u5zr50iy1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p class="rteleft"&gt;Once the new profile is created, next time firefox  start, the profile manager will pop-up and ask the profile that you want  to use.&lt;/p&gt;
&lt;p class="rteleft"&gt;Note that if you want to completely replace your  current profil with the &amp;#8220;Dropbox&amp;#8221; profile, you can simply copy and paste  the content of the old default folder to the new &amp;#8220;Dropbox&amp;#8221; folder and  then delete the default profile from the profile manager.&lt;/p&gt;
&lt;h3&gt;Modify directly the profiles.ini file&lt;/h3&gt;
&lt;p&gt;As an alternative to the UI method presented above, you can modify  directly Firefox initialization file. To do so, you need to locate the  file called &lt;code&gt;profiles.ini&lt;/code&gt;. The path to the file is as follow:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Under Linux: /home/USERNAME/.mozilla/firefox/&lt;/li&gt;
&lt;li&gt;Under windows: C:\Documents and Settings\USERNAME\Application Data\Mozilla\Firefox\&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Open the file with your favorite text editor, and simply add a  profile. After the addition of my dropbox profile, the file looks like  the following:&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u60tbuZN1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p&gt;The StartWithLastProfile indicates whether or not Firefox should ask  you at start-up which profile to use or if it should load the previous  profile that was in use. The first profile is my default profile and the  second profile is the Dropbox profile. To switch to the whole dropbox  solution, you just need to remove the default profile.&lt;/p&gt;
&lt;p&gt;It is of course possible to move the content of your previous default  profile to the new dropbox profile so that all previous information are  copied.&lt;/p&gt;
&lt;h3&gt;A word about security&lt;/h3&gt;
&lt;p&gt;As anything that is stored on the cloud, be careful about what you  put out there. By default, if you have allowed your password to be  stored by Firefox without any master password, they are stored in clear.  I actually haven&amp;#8217;t checked where Firefox stores the passwords as I am  not using it to store my passwords but I wouldn&amp;#8217;t be surprised if it is  stocked somewhere in the profile folder. So even though your Dropbox  folder is private and probably encrypted on the server, better be safe  than sorry. So use other password manager (like keypass for instance).  You&amp;#8217;ve been warned and can&amp;#8217;t blame me if anything goes wrong ;-)&lt;/p&gt;
&lt;h3&gt;Last comment&lt;/h3&gt;
&lt;p&gt;Ok, this post was no rocket science :-). However, it gives a good  overview of what you can do with the so-called &amp;#8220;cloud&amp;#8221; in order not only  to keep your documents synchronized but your preferences. I am sure  that you can use the method with other softwares but as mention  previously, always keep the security in mind! Find out if the  application store any password or personal information before  adventuring yourself with such a solution.&lt;/p&gt;
&lt;p&gt;Based on the scenario presented above, I am sure that one could  easily put a more secure solution in place. One could for instance store  the profile in an encrypted container (with truecrypt) that would be  mounted at start-up. Using Dropbox is not the only solution of course.  One could use his own folder anywhere on the web mounted as a network  drive over ssh. I am sure that you can come up with many ideas about how  to generalize the suggested idea&amp;#8230;&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909488451</link><guid>http://psykocybernetik.com/post/909488451</guid><pubDate>Tue, 07 Jul 2009 22:46:00 +0200</pubDate><category>firefox</category><category>linux</category><category>windows</category></item><item><title>Install Linux Mint on Lenovo X200</title><description>&lt;p&gt;&lt;p class="rteleft"&gt;In my previous post, I detailed how I &lt;a target="_self" href="http://psykocybernetik.tumblr.com/post/909469310/partitioning-lenovo-x200-install-linux"&gt;partitioned&lt;/a&gt; the drive of the X200 in order to install Linux. I will now give a few  words about the installation process of Linux Mint 7. The focus of this  post is set on how to keep your boot loader as it is and allow a dual  boot windows/Linux from the Windows boot loader.&lt;/p&gt;
&lt;p class="rteleft"&gt;There are only a few things that I changed from the  default installation. The first one concerns the partitioning. Since the  drive is already partitioned, it is necessary to tell the installer  which partitions to use for what. From the picture below, you can easily  see which partitions are used and where they are mounted.&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u68oAhST1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p class="rteleft"&gt;The important thing is to mount &lt;code&gt;/boot&lt;/code&gt; on the primary partition created previously (&lt;code&gt;/dev/sda4&lt;/code&gt; in the example above). I decided to create a partition for &lt;code&gt;/home&lt;/code&gt; as well so that a future upgrade of the system doesn&amp;#8217;t overwrite  personal data. This is a good common practice unless upgrade means  global cleaning to you.&lt;/p&gt;
&lt;p class="rteleft"&gt;During the last step of the installation process, it  is important to click on the advanced button if you don&amp;#8217;t want Grub to  be installed on the MBR. As stated in introduction, I want to keep the  MBR so I specified that Grub should be installed on the primary  partition that was created (&lt;code&gt;/dev/sda4&lt;/code&gt;).&lt;/p&gt;
&lt;p class="rteleft"&gt;When installation is finished, restart the computer.  There is at the moment no possibility to boot Linux as the MBR as not be  replaced and no entry has been added to Windows boot file. It is  therefore necessary first to reboot the live CD so that we can copy  Linux boot sector. To do so, open a terminal and enter the following  command:&lt;/p&gt;
&lt;pre class="rteleft"&gt;dd if=/dev/sda4 of=/media/disk/linux.bin bs=512 count=1&lt;/pre&gt;
&lt;p class="rteleft"&gt;In the command line above, don&amp;#8217;t forget to indicate the correct paths to the &lt;code&gt;if&lt;/code&gt; and &lt;code&gt;of&lt;/code&gt; parameters so that it reflects your installation. Note that in the  example above I am copying the boot sector to a USB stick and it is  necessary afterwards to copy from the USB stick to the C drive of  windows.&lt;/p&gt;
&lt;p class="rteleft"&gt;When the boot sector is copied, we can copy it in a windows accessible folder and edit &lt;code&gt;C:\boot.ini&lt;/code&gt;.If there is any problem to edit it, don&amp;#8217;t forget to remove the Read-Only flag by right click &amp;gt; Properties. My &lt;code&gt;boot.ini&lt;/code&gt; looks like the following:&lt;/p&gt;
&lt;pre class="rteleft"&gt;[boot loader]&lt;br/&gt;timeout=15&lt;br/&gt;default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS&lt;br/&gt;[operating systems]&lt;br/&gt;multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect&lt;br/&gt;c:\linux.bin="Linux-Mint"&lt;/pre&gt;
&lt;p class="rteleft"&gt;You can specify the  timeout and default system to start by modifying the line below [boot  loader]. You will notice that when you chose the Linux-Mint entry, Grub  will be called offering you some more options.&lt;/p&gt;
&lt;p class="rteleft"&gt;If you want more detailed instructions concerning the dual boot procedure, I can recommend the following articles:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href="http://www.geocities.com/epark/linux/grub-w2k-HOWTO.html"&gt;Dual-Boot Linux and Windows 2000/Windows XP with GRUB HOWTO&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://ubuntuforums.org/showthread.php?t=807512&amp;amp;page=2"&gt;Add Linux To Boot.ini &lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909473837</link><guid>http://psykocybernetik.com/post/909473837</guid><pubDate>Mon, 06 Jul 2009 18:30:00 +0200</pubDate><category>linux</category><category>lenovo</category></item><item><title>Partitioning Lenovo X200 to Install Linux</title><description>&lt;p class="rteleft"&gt;I wanted to install Linux on my  computer (Lenovo X200) but I was a bit afraid to mess with the partition  table due to the fact that there is a hidden Restore &amp;amp; Recovery  partition available at boot up when one press on the ThinkVantage  button.&lt;/p&gt;
&lt;p class="rteleft"&gt;I did want to keep Windows available as there are a  few programs that can come handy and I didn&amp;#8217;t want to mess with the  default behavior of the computer (understand that the ThinkVantage  button should still work, that windows should still be accessible and  that I can basically still use the laptop the way I used to do :-)).&lt;/p&gt;
&lt;p class="rteleft"&gt;I will explain in the following paragraphs how to  reformat the drive using open source tools and how I created the new  partitions for the X200.&lt;/p&gt;
&lt;ol&gt;&lt;li class="rteleft"&gt;
&lt;p&gt;Download &lt;a href="http://unetbootin.sourceforge.net/"&gt;UNetbootin&lt;/a&gt; and &lt;a href="http://wiki.partedmagic.com/index.php/Downloads"&gt;PartedMagic&lt;/a&gt; and install it on a USB stick.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u6hfAjSu1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p&gt;Make sure that you computer can boot on a USB stick (most recent  computer can if the option is set up properly in the BIOS) and make sure  that your USB stick is bootable. You can as well install it on the  hardrive but if it boots from the harddrive, it may not allow to  reformat the drive.&lt;/p&gt;
&lt;/li&gt;
&lt;li class="rteleft"&gt;
&lt;p&gt;Partition the disk&lt;/p&gt;
&lt;p class="rteleft"&gt;I have divided the process in two parts:&lt;/p&gt;
&lt;ul&gt;&lt;li class="rteleft"&gt; Resize the Windows partition (followed by a reboot to verify that windows AND the recovery partition are accessible) &lt;/li&gt;
&lt;li class="rteleft"&gt; Create the new partitions &lt;/li&gt;
&lt;/ul&gt;&lt;p class="rteleft"&gt;Before resizing the windows partition, do not forget  to defragment the disk so that there is no risk of data loss and to  create a backup of your data. To resize, just boot on the USB stick and  execute GParted. The interface is quite intuitive and many good  tutorials exist online. Resizing is the easy part and can take a while  so just be patient. Once resized, restart the computer and you will  notice that Windows does a check of the drive at startup. The only  problem I noticed was related to the icon of the C drive but I will come  to that later.&lt;/p&gt;
&lt;p class="rteleft"&gt;Now that we have some unused space, we can create the  partitions that we want (reboot on the USB stick one more time to  access GParted). The number of primary partitions is limited to 4 so we  will create one extended partition (that will contain many logical  partitions) and one primary partition. We need the primary partition in  order for Linux to boot without installing the bootloader on the Master  Boot Record (MBR).&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u6l6dneb1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p class="rteleft"&gt;The partitions I have created can be easily seen on the picture above but here is a quick explanation of the steps:&lt;/p&gt;
&lt;ul&gt;&lt;li class="rteleft"&gt;Create an extended partition (just leave around 200&amp;#160;MB at the end)&lt;/li&gt;
&lt;li class="rteleft"&gt;Create an primary partition in the last 200&amp;#160;MB that you left in the first step&lt;/li&gt;
&lt;li class="rteleft"&gt;Within the extended partition, create logical partitions. I have created the following:     
&lt;ul&gt;&lt;li class="rteleft"&gt;Two NTFS partitions&lt;/li&gt;
&lt;li class="rteleft"&gt;One partition that will be for Linux root&lt;/li&gt;
&lt;li class="rteleft"&gt;One partition for Linux home&lt;/li&gt;
&lt;li class="rteleft"&gt;One partition for swap&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p class="rteleft"&gt;Next time Windows restart, there is two more drives  available but as mentioned, the only problem was related to the icon of  the C drive. In order to fix it, launch TweakUI and go the Repair  section to rebuild icons. Restart the computer and everything should be  back to normal.&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u6lxZ3u41qcbewf.png"/&gt;&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;</description><link>http://psykocybernetik.com/post/909469310</link><guid>http://psykocybernetik.com/post/909469310</guid><pubDate>Mon, 06 Jul 2009 00:08:00 +0200</pubDate><category>linux</category><category>lenovo</category><category>partition</category></item><item><title>Create SOCKS Proxy to Bypass Censorship</title><description>&lt;p&gt;&lt;p class="rteleft"&gt;Using the method described in my &lt;a target="_self" href="http://psykocybernetik.tumblr.com/post/909455485/access-pandora-outside-usa"&gt;previous article&lt;/a&gt;,  you can easily see the benefit to bypass censorship. By using the set  up previously described, you can encrypt all your traffic through the  proxy and therefore appear as if you are only having one long SSH  connection.&lt;/p&gt;
&lt;p class="rteleft"&gt;But in addition, it can be a good idea to configure  firefox to use the proxy to resolve the DNS requests (in case the DNS  server you are using are &amp;#8220;filtered&amp;#8221;). To do so, type &amp;#8220;about:config&amp;#8221; in  the adress bar and change the setting of network.proxy.socks_remote_dns  from false to true as shown below.&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u6rp72qx1qcbewf.png"/&gt;&lt;/p&gt;&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909460979</link><guid>http://psykocybernetik.com/post/909460979</guid><pubDate>Wed, 17 Jun 2009 11:29:00 +0200</pubDate><category>proxy</category><category>censorship</category><category>DNS</category></item><item><title>Access Pandora Outside the USA</title><description>&lt;p&gt;&lt;p class="rteleft"&gt;If you enjoy &lt;a href="http://www.pandora.com/"&gt;Pandora&lt;/a&gt; or any content that is restricted to the USA, it is quite annoying when  you cannot access it because you are out of the country (Ha! Good old  Europe).&lt;/p&gt;
&lt;p class="rteleft"&gt;Fortunately, proxies can help you fix the problem quite easily. I used to employ &lt;a href="http://gpass1.com/gpass/download-en"&gt;GPass&lt;/a&gt;.  It is an easy solution to use under Windows but last time I tried to  start it, it couldn&amp;#8217;t find any tunnel. There is however an alternative  solution to put in place if you have a web host in the USA with SSH  connection: create your own proxy tunnel.&lt;/p&gt;
&lt;p class="rteleft"&gt;The process is simple:&lt;/p&gt;
&lt;ol&gt;&lt;li class="rteleft"&gt;Create a SSH tunnel&lt;/li&gt;
&lt;li class="rteleft"&gt;Configure your web browser to use the tunnel.&lt;/li&gt;
&lt;/ol&gt;&lt;p class="rteleft"&gt;&lt;strong&gt; Create a SSH tunnel&lt;/strong&gt;&lt;/p&gt;
&lt;p class="rteleft"&gt;To create a tunnel, open a console (if you are using Windows, you can use Mobaxvt that I described &lt;a href="http://psykocybernetik.tumblr.com/post/909449619/ssh-console-windows"&gt;here&lt;/a&gt;) and enter the following:&lt;/p&gt;
&lt;pre class="rteleft"&gt;ssh -ND localhost:5555 user@host.com&lt;/pre&gt;
&lt;p class="rteleft"&gt;The options are explained below but you can have more details &lt;a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?ssh+1"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;pre class="rteleft"&gt;-N      Do not execute a remote command.&lt;br/&gt;-D port&lt;br/&gt;	Specifies a local "dynamic" application-level port forwarding.&lt;br/&gt;&lt;a href="mailto:user@host.com"&gt;user@host.com&lt;/a&gt;&lt;br/&gt;	Your ssh credentials and webhost address&lt;br/&gt;&lt;/pre&gt;
&lt;p class="rteleft"&gt;In other words, we open a remote session and traffic will be redirected to port 5555 of our machine.&lt;/p&gt;
&lt;p class="rteleft"&gt;&lt;strong&gt;Configure your web browser&lt;/strong&gt;&lt;/p&gt;
&lt;p class="rteleft"&gt;I am using firefox with the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/2464"&gt;FoxyProxy&lt;/a&gt; extension. This extension allows to use different proxy settings  depending on the websites that you are visiting. In other terms, not all  your traffic need to go through your webhost&amp;#8230; only Pandora (and  whatever else you feel like).&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u6v5yojN1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p class="rteleft"&gt;Once the new proxy is created, configure the proxy as  a SOCKS proxy v5, with the configuration given above (address:  localhost, port:5555) as illustrated in the screenshot below.&lt;/p&gt;
&lt;p class="rteleft"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u6w1XFyc1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p class="rteleft"&gt;Then, you can configure foxyproxy to use patterns as  shown below and you should now have access to Pandora (or whatever you  configure) from wherever you are.&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u6zxvbPs1qcbewf.png"/&gt;&lt;/p&gt;&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909455485</link><guid>http://psykocybernetik.com/post/909455485</guid><pubDate>Tue, 16 Jun 2009 22:59:00 +0200</pubDate><category>ssh</category><category>tunnel</category><category>pandora</category><category>proxy</category></item><item><title>SSH Console Under Windows</title><description>&lt;p&gt;&lt;p class="rteleft"&gt;While looking for an easy (and  immediate) way to get an SSH console to windows, I found MobaXVT. It is  describe as a &amp;#8220;Free portable X server with Unix/Cygwin utilities&amp;#8221;.  As  the description suggest, it is actually a Cygwin encapsulation into a  nice multi-tab interface that has a built-in (among other things that I  didn&amp;#8217;t test) SSH client. Anyway, if you are just looking to have an SSH  client under Windows, this is a great solution if you are allergic to  the Cygwin installation. This is available for free download at &lt;a href="http://mobaxvt.mobatek.net/en/"&gt;&lt;a href="http://mobaxvt.mobatek.net/en/"&gt;http://mobaxvt.mobatek.net/en/&lt;/a&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u744uCMV1qcbewf.png"/&gt;&lt;/p&gt;&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909449619</link><guid>http://psykocybernetik.com/post/909449619</guid><pubDate>Thu, 11 Dec 2008 00:06:00 +0100</pubDate><category>ssh</category><category>windows</category></item><item><title>SSH with PAM and private / public key authentication on Lacie Edmini</title><description>&lt;p&gt;Following the article where I explain &lt;a href="http://psykocybernetik.tumblr.com/post/909393412/add-ssh-lacie-edmini-v2"&gt;how to install a SSH server on the Lacie Edmini&lt;/a&gt;,  I will explain how to allow authentication through the use of private /  public key so that you can use the method explain in this &lt;a href="http://psykocybernetik.tumblr.com/post/909365003/backup-your-files-rsync-ssh"&gt;article&lt;/a&gt; to backup your files on your local server.&lt;/p&gt;
&lt;p&gt;During the &lt;a href="http://psykocybernetik.tumblr.com/post/909393412/add-ssh-lacie-edmini-v2"&gt;installation of the SSH server&lt;/a&gt;,  we didn&amp;#8217;t touch anything in the SSH configuration files. The result was  that you could login with the root user you created during the process.  The first thing I want to do is to allow a normal user to use ssh.  Doing so is easy. Just open the &lt;code&gt;/etc/passwd&lt;/code&gt; file and modify the line with the user you want to allow so that it finishes by &lt;code&gt;/bin/bash&lt;/code&gt; or &lt;code&gt;/bin/sh&lt;/code&gt; depending on the shell you prefer. Finally, a user allowed to connect with ssh will have a line look like:&lt;/p&gt;
&lt;pre&gt;normalUser:x:503:100:Linux User,,,:/home/normalUserDirectory:/bin/bash&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;The other difference is the home directory that I modified to &lt;code&gt;/home/userNameDirectory&lt;/code&gt; instead of just &lt;code&gt;/home&lt;/code&gt;.  This step is necessary to create a directory on which the user has full  rights and therefore can add and modify everything he wants. With your  root user ssh access, do&lt;/p&gt;
&lt;pre&gt;mkdir /home/normalUserDirectory #create user directory&lt;br/&gt;chown 503 /home/normalUserDirectory #change owner so that it is the same as in /etc/passwd&lt;br/&gt;chgrp 100 /home/normalUserDirectory #change group so that it is the same as in /etc/passwd &lt;br/&gt;chgrp 100 /home # change group so that it is the same as your user &lt;br/&gt;chmod 750 /home &lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Changing the permission of the home directory is required by ssh so that  the user will be allowed to connect using his private key. You then  need to create a &lt;code&gt;.ssh&lt;/code&gt; directory under &lt;code&gt;/home/normalUserDirectory&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;mkdir /home/normalUserDirectory/.ssh&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;and change the permissions as we just did before.&lt;/p&gt;
&lt;pre&gt;chown 503 /home/normalUserDirectory/.ssh&lt;br/&gt;chgrp 100 /home/normalUserDirectory/.ssh&lt;br/&gt;chmod 700 /home/normalUserDirectory/.ssh&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;In your computer (Linux, Windows with Cygwin, Window with Putty), generate the keys that we will need for authentication. In &lt;a target="_self" href="http://psykocybernetik.tumblr.com/post/909365003/backup-your-files-rsync-ssh"&gt;a previous post&lt;/a&gt;, I used a dsa key:&lt;/p&gt;
&lt;pre&gt;ssh-keygen -b 1024 -f identity -P '' -t dsa&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;but you could use as well a rsa key:&lt;/p&gt;
&lt;pre&gt;ssh-keygen -b 2048 -f identity -P '' -t rsa&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;There are different ways to do it but what&amp;#8217;s important is that you  verify that the identity.pub that is generated and contains the public  key has everything on one line. Verify that the user name at the end of  the line is the same that the one you want to allow on the server (i.e.  normalUser). Once you have ensure that the file is correct, you can  transfer it to the server in the .ssh directory that we have created  earlier:&lt;/p&gt;
&lt;pre&gt;scp identity.pub new_root_user@Lacie_IP_address:/home/normalUserDirectory/.ssh/authorized_keys&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;And then don&amp;#8217;t forget to change owner and group of the authorized_keys file and permissions&lt;/p&gt;
&lt;pre&gt;chown 503 /home/normalUserDirectory/.ssh/authorized_keys&lt;br/&gt;chgrp 100 /home/normalUserDirectory/.ssh/authorized_keys&lt;br/&gt;chmod 644 /home/normalUserDirectory/.ssh/authorized_keys #you can specify 400 as well&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;For an alternative transfer method, look at the previous post  reference above but one more time don&amp;#8217;t forget to set the correct owner  and group.&lt;/p&gt;
&lt;p&gt;Everything is in place to use the identification with private / public  key on the server. The last thing to do is to verify your  /etc/ssh/sshd_config file so that it looks like the following:&lt;/p&gt;
&lt;pre&gt;#    $OpenBSD: sshd_config,v 1.74 2006/07/19 13:07:10 dtucker Exp $&lt;br/&gt;# This is the sshd server system-wide configuration file.  See&lt;br/&gt;# sshd_config(5) for more information.&lt;br/&gt;# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin&lt;br/&gt;# The strategy used for options in the default sshd_config shipped with&lt;br/&gt;# OpenSSH is to specify options with their default value where&lt;br/&gt;# possible, but leave them commented.  Uncommented options change a&lt;br/&gt;# default value.&lt;br/&gt;#Port 22&lt;br/&gt;Protocol 2&lt;br/&gt;#AddressFamily any&lt;br/&gt;#ListenAddress 0.0.0.0&lt;br/&gt;#ListenAddress ::&lt;br/&gt;# HostKey for protocol version 1&lt;br/&gt;#HostKey /etc/ssh/ssh_host_key&lt;br/&gt;# HostKeys for protocol version 2&lt;br/&gt;#HostKey /etc/ssh/ssh_host_rsa_key&lt;br/&gt;#HostKey /etc/ssh/ssh_host_dsa_key&lt;br/&gt;# Lifetime and size of ephemeral version 1 server key&lt;br/&gt;#KeyRegenerationInterval 1h&lt;br/&gt;#ServerKeyBits 768&lt;br/&gt;# Logging&lt;br/&gt;# obsoletes QuietMode and FascistLogging&lt;br/&gt;#SyslogFacility AUTH&lt;br/&gt;#LogLevel INFO&lt;br/&gt;# Authentication:&lt;br/&gt;#LoginGraceTime 2m&lt;br/&gt;#PermitRootLogin yes&lt;br/&gt;#StrictModes yes&lt;br/&gt;#MaxAuthTries 6&lt;br/&gt;# Allow authentication through private / public key&lt;br/&gt;#RSAAuthentication yes &lt;br/&gt;#PubkeyAuthentication yes &lt;br/&gt;#AuthorizedKeysFile .ssh/authorized_keys &lt;br/&gt;# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts&lt;br/&gt;#RhostsRSAAuthentication no&lt;br/&gt;# similar for protocol version 2&lt;br/&gt;#HostbasedAuthentication no&lt;br/&gt;# Change to yes if you don't trust ~/.ssh/known_hosts for&lt;br/&gt;# RhostsRSAAuthentication and HostbasedAuthentication&lt;br/&gt;#IgnoreUserKnownHosts no&lt;br/&gt;# Don't read the user's ~/.rhosts and ~/.shosts files&lt;br/&gt;#IgnoreRhosts yes&lt;br/&gt;# To disable tunneled clear text passwords, change to no here!&lt;br/&gt;PasswordAuthentication no&lt;br/&gt;#PermitEmptyPasswords no&lt;br/&gt;# Change to no to disable s/key passwords&lt;br/&gt;#ChallengeResponseAuthentication yes&lt;br/&gt;# Kerberos options&lt;br/&gt;#KerberosAuthentication no&lt;br/&gt;#KerberosOrLocalPasswd yes&lt;br/&gt;#KerberosTicketCleanup yes&lt;br/&gt;#KerberosGetAFSToken no&lt;br/&gt;# GSSAPI options&lt;br/&gt;#GSSAPIAuthentication no&lt;br/&gt;#GSSAPICleanupCredentials yes&lt;br/&gt;# Set this to 'yes' to enable PAM authentication, account processing, &lt;br/&gt;# and session processing. If this is enabled, PAM authentication will &lt;br/&gt;# be allowed through the ChallengeResponseAuthentication and&lt;br/&gt;# PasswordAuthentication.  Depending on your PAM configuration,&lt;br/&gt;# PAM authentication via ChallengeResponseAuthentication may bypass&lt;br/&gt;# the setting of "PermitRootLogin without-password".&lt;br/&gt;# If you just want the PAM account and session checks to run without&lt;br/&gt;# PAM authentication, then enable this but set PasswordAuthentication&lt;br/&gt;# and ChallengeResponseAuthentication to 'no'.&lt;br/&gt;UsePAM yes&lt;br/&gt;#AllowTcpForwarding yes&lt;br/&gt;#GatewayPorts no&lt;br/&gt;#X11Forwarding no&lt;br/&gt;#X11DisplayOffset 10&lt;br/&gt;#X11UseLocalhost yes&lt;br/&gt;#PrintMotd yes&lt;br/&gt;#PrintLastLog yes&lt;br/&gt;#TCPKeepAlive yes&lt;br/&gt;#UseLogin no&lt;br/&gt;#UsePrivilegeSeparation yes&lt;br/&gt;#PermitUserEnvironment no&lt;br/&gt;#Compression delayed&lt;br/&gt;#ClientAliveInterval 0&lt;br/&gt;#ClientAliveCountMax 3&lt;br/&gt;#UseDNS yes&lt;br/&gt;#PidFile /var/run/sshd.pid&lt;br/&gt;#MaxStartups 10&lt;br/&gt;#PermitTunnel no&lt;br/&gt;# no default banner path&lt;br/&gt;#Banner /some/path&lt;br/&gt;# override default of no subsystems&lt;br/&gt;Subsystem    sftp    /usr/lib/misc/sftp-server&lt;br/&gt;# Example of overriding settings on a per-user basis&lt;br/&gt;#Match User anoncvs&lt;br/&gt;#    X11Forwarding no&lt;br/&gt;#    AllowTcpForwarding no&lt;br/&gt;#    ForceCommand cvs server&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;All commented lines are in fact the default value that SSHd is using. I  haven&amp;#8217;t modify it at all so it is the default file contained in the SSH  package that you have downloaded from my previous post explaining how to  &lt;a href="http://psykocybernetik.tumblr.com/post/909393412/add-ssh-lacie-edmini-v2"&gt;install SSH on the Lacie Edmini&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s it! SSH is running and allows you to login automatically in the home directory of your normal user with:&lt;/p&gt;
&lt;pre&gt;ssh -i identity -l userNormal LACIE_IP_ADDRESS &lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Of course you should specify the correct path to the private key  (identity). I have noticed that I could have some problem when the  public and private keys where in the same directory so since you don&amp;#8217;t  really need the public key anymore you can move it to another folder.&lt;/p&gt;
&lt;p&gt;The normal users can now realizes their backup easily in their own directory.&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909441771</link><guid>http://psykocybernetik.com/post/909441771</guid><pubDate>Thu, 17 Apr 2008 00:04:00 +0200</pubDate><category>ssh</category><category>private key</category><category>authentication</category></item><item><title>Add SSH on a LaCie EdMini v2</title><description>&lt;p&gt;In a &lt;a title="previous post" target="_self" href="http://psykocybernetik.tumblr.com/post/909365003/backup-your-files-rsync-ssh"&gt;previous post&lt;/a&gt;,  I explained how to make automatic backup on a server using SSH. I was  suggesting that the server was somewhere on the Internet so we didn&amp;#8217;t  have to deal with any SSH installation. However, sometimes some data are  to sensible to be stocked somewhere on the Internet so a good idea is  to have your own little server running SSH. In addition, once data are  backuped on your local server you can decide (automatically) which one  of them can be send on a distant server.&lt;/p&gt;
&lt;p&gt;I have a Lacie Edmini V2 (ethernet gigabit disk). It is a nice little  network harddrive coming with a Linux OS. It already has a Http and Ftp  server but unfortunately, no SSH or rsync. Therefore, before being able  to use the &lt;a title="backup scripts" target="_self" href="http://psykocybernetik.tumblr.com/post/909365003/backup-your-files-rsync-ssh"&gt;backup scripts&lt;/a&gt; we have to install these two services. Fortunately for us, some good  work has already be done by some people. But unfortunately, I&amp;#8217;m not as  good with Linux as these guys are so everything they said was not always  really clear. That is mainly the reason why I will try to create a  guide that will be a little bit more explicit. I still assume however  that you have some basic Linux knowledge.&lt;/p&gt;
&lt;p&gt;Our starting points are the following 3 sources:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;a target="_blank" href="http://lacie.nas-central.org/index.php/SuccessStories"&gt;edmini V2 as a Home Server&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://luon.net/%7Eadmar/journal/LaCieEthernetDiskMini.html"&gt;LaCie Ethernet Disk mini&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a target="_blank" href="http://www.federated.com/%7Ejim/edmini/"&gt;Turning a Lacie Ethernet Disk Mini into Your Server&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Have a look at them before we start our work and if you don&amp;#8217;t  understand everything, don&amp;#8217;t worry&amp;#8230; I didn&amp;#8217;t either. Under is the list  of things we are going to do to add SSH support to your Lacie Edmini.&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Open your drive and void the warranty (and don&amp;#8217;t blame me or anyone  else if sonething is going wrong. As usual you are doing this at your  own risk!)&lt;/li&gt;
&lt;li&gt;Install the drive in another computer or in a USB case&lt;/li&gt;
&lt;li&gt;Backup the system partitions&lt;/li&gt;
&lt;li&gt;Copy the packages we will need to install&lt;/li&gt;
&lt;li&gt;Install the shell backdoor&lt;/li&gt;
&lt;li&gt;Create new user to use the packages we will install&lt;/li&gt;
&lt;li&gt;Put the disk back in place&lt;/li&gt;
&lt;li&gt;Start Telnet&lt;/li&gt;
&lt;li&gt;Install SSH&lt;/li&gt;
&lt;li&gt;Configure SSH&lt;/li&gt;
&lt;li&gt;Remove backdoor and telnet script&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Alright, now that you know what we are going to do, let&amp;#8217;s do it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; Open drive (void warranty) and install it on another computer&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;There is no more to explain than Jim already did  in &lt;a target="_blank" href="http://www.federated.com/%7Ejim/edmini/"&gt;here&lt;/a&gt;.  Have I mentionned already that you need a computer with a Linux running  to do the next steps? Well if you don&amp;#8217;t have any Linux installed, you  can always do it with a live CD (have a look at &lt;a target="_blank" href="http://knopper.net/knoppix/index-en.html"&gt;Knoppix&lt;/a&gt; or &lt;a target="_blank" href="http://www.ubuntu.com/"&gt;Ubuntu&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; Backup the system partitions&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As I was not really comfortable to  do a backup using the command  line tool dd and I didn&amp;#8217;t want to use too much space on backup, I went  for a more interactive backup tool: &lt;a target="_blank" href="http://www.partimage.org/"&gt;partimage&lt;/a&gt;.  There is not much to say here, just start the software and backup the  system partitions, which are given by the 3 sources above, i-e  partitions 7, 8 and 9. I recommand that you backup these partitions on  another hard drive (the one of your computer for instance). In case  anything goes wrong you will still have the possibility to restore the  system.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; Copy useful packages&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://lacie.nas-central.org/index.php/SuccessStories"&gt;Juergen Hench&lt;/a&gt; found that many packages compiled for other NAS drive where working on  the Lacie Edmini (the list of compiled packages is available &lt;a target="_blank" href="http://buffalo.nas-central.org/download/LSPro_ARM9/Distributions/Genlink/Binaries/armv5tejl-softfloat-linux-gnueabi/"&gt;here&lt;/a&gt;). So copy on the partition 2 of your drive (the data partition (share/)) the following packages&amp;#160;:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;bzip2&lt;/li&gt;
&lt;li&gt;openssh&lt;/li&gt;
&lt;li&gt;openssl&lt;/li&gt;
&lt;li&gt;popt&lt;/li&gt;
&lt;li&gt;rsync&lt;/li&gt;
&lt;li&gt;tcp-wrappers&lt;/li&gt;
&lt;li&gt;zlib&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;You may also have to download telnet here&amp;#160;:&lt;/p&gt;
&lt;pre&gt;&lt;a title="http://downloads.nas-central.org/Uploads/LSPro/Binaries/utelnetd" href="http://downloads.nas-central.org/Uploads/LSPro/Binaries/utelnetd"&gt;&lt;a href="http://downloads.nas-central.org/Uploads/LSPro/Binaries/utelnetd"&gt;http://downloads.nas-central.org/Uploads/LSPro/Binaries/utelnetd&lt;/a&gt;&lt;/a&gt;&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt; Install the shell backdoor&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The three sources explain to create a file (we will call it webshell) containing the following:&lt;/p&gt;
&lt;pre&gt;#!/bin/sh &lt;br/&gt;echo "Content-type: text/plain"&lt;br/&gt;echo ""&lt;br/&gt;echo $QUERY_STRING&lt;br/&gt;eval $QUERY_STRING&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;and to put it in the partition 7 under the /www/cgi-bin/admin/  directory. Change the permission of the file to make it executable:&lt;/p&gt;
&lt;pre&gt;chmod +x /www/cgi-bin/admin/webshell&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;While you&amp;#8217;re at it, change the permission of the telnet daemon that you have downloaded earlier to make it executable as well:&lt;/p&gt;
&lt;pre&gt;chmod +x /home/share/utelnetd&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt; Create new user&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;While I was following the steps given by the tutorials I base my work  on, I always got a problem when they create the root user that will be  able to use SSH or Telnet. Unfortunately for me, each time I was using  the webshell to add a user, I screwed things up but I don&amp;#8217;t really know  how or why. That&amp;#8217;s the reason why I decided to create the new user we  would need later while the drive is still connected to the computer.&lt;/p&gt;
&lt;p&gt;Look for the passwd file (&lt;code&gt;find / -name passwd&lt;/code&gt;). The one  we are interested in is located under a &amp;#8220;etc&amp;#8221; directory. But you will  probably find 2 of them. So the one we are interested in is not in  partition 7 (but I can&amp;#8217;t remember if it is in partition 8 or 9). It  means that the path to it is something like &amp;#8230;/snaps/00/etc/passwd.   Once identified, open it with your favorite editor. If you have created  other users than the admin default one then you should see them in the  file. It shows that you are in the right file. So basically we will add  two lines: one for a root user and one for the ssh user that is required  to start openssh.&lt;/p&gt;
&lt;pre&gt;new_root:x:0:0:Linux User,,,:/home:/bin/sh&lt;br/&gt;sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Once done, we have to edit the &amp;#8220;shadow&amp;#8221; file located in the  same directory as the passwd file and add a line for the new_root user.  The &amp;#8220;shadow&amp;#8221; file contains the encrypted password of all users. You can  copy the encrypted password of your admin account for instance or left  the field blank for the moment. I copied the other values from the  others lines.&lt;/p&gt;
&lt;pre&gt;new_root:encrypted_pass:12488:0:99999:7:::&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt; Put the disk back in place and start telnet&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Once your drive is reassembled and restarted, we will be able to  start the Telnet daemon. To do so, just connect to your drive with your  webbrowser&lt;/p&gt;
&lt;pre&gt;&lt;a title="http://LACIE_IP_ADDRESS/cgi-bin/admin/webshell?/home/share/utelnetd" href="http://lacie_ip_address/cgi-bin/admin/webshell?/home/share/utelnetd"&gt;http://LACIE_IP_ADDRESS/cgi-bin/admin/webshell?/home/share/utelnetd&lt;/a&gt;&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Of course, I suppose here that you have put the packages  downloaded previously on the share folder of the data partition. If you  have put it elsewhere, just specify the correct path. Once telnet is  started, you should be able to connect to your drive through it. Open a  console (or command prompt) and try&lt;/p&gt;
&lt;pre&gt;telnet new_root@LACIE_IP_ADDRESS&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;If you don&amp;#8217;t have specified a password yet you should be connected right away and it is the moment to add one&lt;/p&gt;
&lt;pre&gt;passwd new_root&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt; Install SSH&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With this telnet access we can install SSH. So with the packages that you have downloaded previously just do&lt;/p&gt;
&lt;pre&gt;tar -xvjf PACKAGE.bz2 -C /&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;I think I haven&amp;#8217;t forgot any packages so the service should be able to start. However if you try a &lt;code&gt;/sbin/sshd&lt;/code&gt; it will complain about missing keys. So to correct it and allow ssh to  start when the harddrive starts we will create an init script. It is  based on what you have read &lt;a target="_blank" href="http://lacie.nas-central.org/index.php/SuccessStories"&gt;here&lt;/a&gt; but modified a bit to create the keys automatically if they do not  exist. So here is the file called &amp;#8220;sshd&amp;#8221; that you have to put under  /etc/rc.d/init.d/ and / or .under &amp;#8230;/snaps/00/etc/rc.d/init.d/&lt;/p&gt;
&lt;pre&gt;#!/bin/sh&lt;br/&gt;# Begin $rc_base/init.d/&lt;br/&gt;# Based on sysklogd script from LFS-3.1 and earlier.&lt;br/&gt;# Rewritten by Gerard Beekmans  - &lt;a href="mailto:gerard@linuxfromscratch.org"&gt;gerard@linuxfromscratch.org&lt;/a&gt;&lt;br/&gt;# changed a bit by Juergen Hench to run sshd, made from httpd&lt;br/&gt;# changed a bit by Jimmy B. to create the ssh keys if they do not exist already&lt;br/&gt;. /etc/sysconfig/rc&lt;br/&gt;. $rc_functions&lt;br/&gt;. /etc/packageversion&lt;br/&gt;case "$1" in&lt;br/&gt;    start)&lt;br/&gt;        echo "Starting OpenSSH sshd..."&lt;br/&gt;        # Start OpenSSH server &lt;br/&gt;        if [ ! -r /etc/ssh/ssh_host_rsa_key ]; then&lt;br/&gt;            /usr/bin/ssh-keygen -t rsa1 -f /etc/ssh/ssh_host_rsa_key -N ''&lt;br/&gt;        fi&lt;br/&gt;        if [ ! -r /etc/ssh/ssh_host_dsa_key ]; then&lt;br/&gt;            /usr/bin/ssh-keygen -b 1024 -t dsa -f /etc/ssh/ssh_host_dsa_key -N ''&lt;br/&gt;        fi&lt;br/&gt;        /usr/sbin/sshd&lt;br/&gt;        evaluate_retval&lt;br/&gt;        ;; &lt;br/&gt;    stop)&lt;br/&gt;        echo "Stopping sshd..."&lt;br/&gt;        killproc sshd&lt;br/&gt;        ;;&lt;br/&gt;    restart)&lt;br/&gt;        $0 stop&lt;br/&gt;        sleep 1&lt;br/&gt;        $0 start&lt;br/&gt;        ;; &lt;br/&gt;    status)&lt;br/&gt;        statusproc sshd&lt;br/&gt;        ;;&lt;br/&gt;    *)&lt;br/&gt;    echo "Usage: $0 {start|stop|restart|status}"&lt;br/&gt;    exit 1&lt;br/&gt;    ;;&lt;br/&gt;esac&lt;br/&gt;# End $rc_base/init.d/&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Don&amp;#8217;t forget to make it executable &lt;code&gt;chmod +x /etc/rc.d/init.d/sshd&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;While we&amp;#8217;re at it we can create already the symlinks to start  automatically [Edit 2008-05-05] An error has been corrected below  following a comment [/Edit]:&lt;/p&gt;
&lt;pre&gt;ln -s  ../../init.d/sshd /etc/rc.d/rc3.d/S20sshd &lt;br/&gt;ln -s ../../init.d/sshd /etc/rc.d/rc6.d/K09sshd &lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Alright, we are almost done. Try to start SSHd just by doing &lt;code&gt;/etc/rc.d/init.d/sshd start&lt;/code&gt;.  It shouldn&amp;#8217;t complain anymore about missing keys, but if you try to  connect using ssh and the new_root account, you may still have some  problem (at least I did). I identified the problem to be coming from the  PAM security module. So there is one more thing to modify. We will  modify the file /etc/pam.d/sshd (taken from &lt;a target="_blank" href="http://www-uxsup.csx.cam.ac.uk/pub/doc/suse/sles9/adminguide-sles9/ch20s02.html"&gt;Suse  SUSE LINUX Enterprise Server – Installation and Administration -  Chapter 20. PAM — Pluggable Authentication Modules / 20.2. The PAM  Configuration of sshd&lt;/a&gt; and modified a bit).&lt;/p&gt;
&lt;pre&gt;#%PAM-1.0&lt;br/&gt;auth required   pam_unix.so # set_secrpc&lt;br/&gt;auth required   pam_nologin.so&lt;br/&gt;auth required   pam_env.so&lt;br/&gt;account required        pam_unix.so&lt;br/&gt;account required        pam_nologin.so&lt;br/&gt;password required       pam_pwcheck.so&lt;br/&gt;password required       pam_unix.so    use_first_pass use_authtok&lt;br/&gt;session required        pam_unix.so    none     # trace or debug&lt;br/&gt;session required        pam_limits.so&lt;br/&gt;# Enable the following line to get resmgr support for&lt;br/&gt;# ssh sessions (see /usr/share/doc/packages/resmgr/README.SuSE)&lt;br/&gt;#session  optional      pam_resmgr.so fake_ttyname&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Just create a file (pam_sshd) containing the content above and put it on  your drive (in the data partition for instance). Then using you&amp;#8217;re  telnet session or the webshell, just move it properly:&lt;/p&gt;
&lt;pre&gt;cp /etc/pam.d/sshd /etc/pam.d/sshd.bak &lt;br/&gt;cp /home/share/pam_sshd /etc/pam.d/sshd &lt;br/&gt;/etc/rc.d/init.d/sshd restart &lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Try to login again&amp;#8230; it should work!&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;br/&gt; Remove webshell and telnet&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Once ssh is working properly, you can remove the webshell backdoor and the telnet script.&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s all I have done for the moment on this disk. I hope I have been  clear enough. More can be done with this box as you have seen in the  other articles I base my work on. I haven&amp;#8217;t tried yet to use the backup  method explained in another post but I will eventually. If you have any  problem, you can try to post a comment and I&amp;#8217;ll help in the limit of my  time and my knowledge.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Follow up&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I have written another post to allow the automatic login with SSH through the use of private / public key. It is available &lt;a href="http://psykocybernetik.tumblr.com/post/909441771/ssh-pam-and-private-public-key-authentication-lacie-edmi"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909393412</link><guid>http://psykocybernetik.com/post/909393412</guid><pubDate>Fri, 21 Mar 2008 18:22:00 +0100</pubDate><category>ssh</category><category>lacie</category><category>edmini</category></item><item><title>SSH restrictions</title><description>&lt;p&gt;A few days ago I was explaining how to &lt;a title="Backup your files" target="_self" href="http://psykocybernetik.tumblr.com/post/909365003/backup-your-files-rsync-ssh"&gt;backup your important files&lt;/a&gt; using rsync and ssh. This solution allowed to transfer some content to  your server in a secure way. Of course, I was using this solution  myself, but I got some problems while using it due to SSH limitations  with my webhost (&lt;a target="_blank" href="http://www.webhostingbuzz.com/"&gt;webhostingbuzz&lt;/a&gt;). Indeed, after 30 minutes of connection, the SSH session was killed and therefore rsync that was using it got frozen.&lt;/p&gt;
&lt;p&gt;After some researches on this Internet, I found some options to give  to the SSH command to maintain a connection open with the server.   Different solutions exist:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;&lt;code&gt;TCPKeepAlive=yes&lt;/code&gt;. This is the default value so it your client will send KeepAlive messages to the server but not through the SSH channel.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ServerAliveInterval=15&lt;/code&gt; . This specifies a time in  second during which the client accept not to receives any answer for the  server. It is multiplied by the ServerAliveCountMax parameter to give  the total time after which your client will be considered disconnected  from the server. The default value of ServerAliveCountMax is three so by  specifying ServerAliveInterval=15 you allow your ssh session not to  receive any answer during 45 seconds after which the session will be  considered as lost. This ServerAlive messages are sent through the SSH  channel.&lt;/li&gt;
&lt;li&gt;Specify a command that SSH should use in the background to ensure  that there is activity between the client and the server. This is a  command like &lt;code&gt;while date ; do sleep 10 ; done&lt;/code&gt;. For more information you can have a look at &lt;a target="_blank" href="http://madphilosopher.ca/2005/07/an-ssh-keep-alive-tip/"&gt;The Mad Philosopher&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;But none of this options was working for me. So I decided to contact  my webhost support and ask them how I could do my backup. I received an  answer saying that indeed all SSH connections were closed every 30  minutes for security reason and that I could use FTP instead. In  addition, my transfer was requiring too many resources so my account  could get suspended. After many emails to try to find a solution, I  decided to use FTP which shouldn&amp;#8217;t have any time limit according to the  support.&lt;/p&gt;
&lt;p&gt;The problem with the use of FTP is that transfer is not secure, and  that it becomes much harder to put exclusion rules. In addition, using  rsync afterwards is not possible since file properties are not sent  through ftp.&lt;/p&gt;
&lt;p&gt;So, if you have or know any good host that allows unlimited ssh access, please leave a comment. It can be useful!&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909374294</link><guid>http://psykocybernetik.com/post/909374294</guid><pubDate>Mon, 03 Mar 2008 12:58:00 +0100</pubDate><category>ssh</category><category>backup</category><category>ftp</category></item><item><title>Find Other Websites Hosted On Your Server</title><description>&lt;p&gt;If you are using a shared webhosting like I do,  it can be interesting to know which websites are located on the same  server. Indeed, if you find your site too slow, it may be because  another website is consuming too much resources. There can as well be  some problems if you are sharing your IP address with some site that are  censored abroad. Indeed, if one of the site of the server is blocked,  the IP is probably blocked so you will not be able to access your own  site even though there is nothing to censor in it. And you will not be  able to do &lt;a target="_self" href="http://psykocybernetik.tumblr.com/post/909340042/create-proxy"&gt;that&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;So here are two interesting links to find it out, but be aware that a few hundred of website can be located on the same server:&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://www.myipneighbors.com/"&gt;My IP neighbors&lt;/a&gt;&lt;br/&gt;&lt;a target="_blank" href="http://www.yougetsignal.com/tools/web-sites-on-web-server/"&gt;You get signal&lt;/a&gt;&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909386159</link><guid>http://psykocybernetik.com/post/909386159</guid><pubDate>Mon, 03 Mar 2008 12:58:00 +0100</pubDate><category>IP address</category><category>DNS</category></item><item><title>Backup your file with rsync and ssh</title><description>&lt;p&gt;If you have many important files on your  computer, you probably saved them somewhere, from time to time: usb key,  CD, server&amp;#8230; the choice is yours.  But the problem is to maintain this  backup up-to-date. So what about making a backup à la &amp;#8220;time-machine&amp;#8221; to  save your files on a regular basis and be able to access previous  versions or the latest one easily. We will realize a backup of the files  of the computer to our web hosting / server.&lt;/p&gt;
&lt;p&gt;For that, we&amp;#8217;ll use the linux tools rsync and ssh. This tools are  usually built-in in Linux distributions or you can easily install them  otherwise with your favorite packet manager. Under Windows, that&amp;#8217;s  another story but nothing is completely lost. I will begin to describe  how-to install the tools under Windows (sometimes you just don&amp;#8217;t have  the choice of your OS) and then describe the backup procedure. The  procedure applies for both linux and windows.&lt;/p&gt;
&lt;p&gt;I make here the assumption that you have an ssh access to your  distant server. This will allow you to have an encrypted connection  between your computer and the server and and therefore will prevent  anyone to intercept your backups when you send them.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; Cygwin (SSH and Rsync)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Cygwin is a software allowing you to use Linux tools under Windows. First thing to do is to download it &lt;a target="_blank" href="http://cygwin.com/"&gt;here&lt;/a&gt; and to install it. There is nothing special to say about it.  Installation is pretty straight forward. For what I have observed some  ftp sites are not responding so I recommend the following:  &lt;a href="http://ftp.easynet.be"&gt;ftp.easynet.be&lt;/a&gt;, &lt;a href="http://ftp.gwdg.de"&gt;ftp.gwdg.de&lt;/a&gt;, &lt;a href="http://ftp.heanet.ie"&gt;ftp.heanet.ie&lt;/a&gt; or mirror.calvin.edu. Just  install the default files and in addition select the packages &amp;#8220;rsync&amp;#8221;  and &amp;#8220;openssh&amp;#8221;. This will install some dependency packages as well, just  go ahead. Once everything is installed, just execute Cygwin.bat in your  installation directory and you will see something like:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u805H8Yd1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; SSH automatic authentication&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;To simplify the backup process, we will generate a private and a  public key to allow automatic authentication on the server from your  computer. On your newly installed cygwin console, just type:&lt;/p&gt;
&lt;pre&gt;ssh-keygen -b 1024 [-f identity] -P '' -t dsa&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;ssh-keygen will generate a couple of private / public key. The  length (in bit) is given by the option &amp;#8220;-b 1024&amp;#8221;, the name of the file  is given by the option &amp;#8220;-f identity&amp;#8221;, the passphrase by &amp;#8220;-P &amp;#8221; and  finally the type by &amp;#8220;-t dsa&amp;#8221;. We specify an empty passphrase here since  we want to be able to connect automatically to the server without having  to enter manually any password. This can be dangerous as we will see  later so please keep your private key PRIVATE. By default you should now  have two new files in your C:\Documents and Settings\user directory  named &amp;#8220;identity&amp;#8221; (private key) and &amp;#8220;identity.pub&amp;#8221; (public key).&lt;/p&gt;
&lt;p&gt;If necessary, modify the public key file so that it finishes with a  valid ssh user, i-e a ssh user allowed to connect to your server  (typically it should finish with the username you are using to connect  to the server through ssh).&lt;/p&gt;
&lt;p&gt;Next step will be to transfer the public key to the server. You can  do it in many different ways. Just keep in mind that ftp is not secure  so why not use sftp instead since you have a ssh access on your server?  An easy way to use sftp is simply to use a ftp client (like &lt;a title="Filezilla client" target="_blank" href="http://filezilla-project.org/download.php?type=client"&gt;filezilla&lt;/a&gt;)  and to enter your ssh account credentials. The default port is 22 but  check with your web host since it can be something different.&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u817HUnw1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p&gt;On the server, at the root of your home directory, you should create  (if it doesn&amp;#8217;t exist already) a .ssh directory. Move the public key  (identity.pub) that you have created to this directory. Then if you  don&amp;#8217;t have a file called authorized_keys just rename your &amp;#8220;identity.pub&amp;#8221;  to &amp;#8220;authorized_keys&amp;#8221;. Change the permissions of the file to only allow  the reading by the owner of the file. You can modify the permissions  with filezilla (right click on the file) or through ssh:&lt;/p&gt;
&lt;pre&gt;chmod 400 .ssh/authorized_keys&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Once we have done that, it is time to modify the client side,  i.e. your computer. Cygwin should have created a .ssh directory in your  user folder. I suggest that you move your private key (identity) to this  directory. And now it is time to try this automatic connection. Open a  Cygwin console and type:&lt;/p&gt;
&lt;pre&gt;ssh -i .ssh/identity -p 22 -l username yoursite.com&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;This command tries to open a ssh session using the private key  identity (you have to specify the path of the file: -i .ssh/identity),  on the port 22 (-p 22 but as before check if your ssh access is done  through the default port), with the user username (-l username) on the  distant host yoursite.com. If everything works you should now be  connected to your server without having to enter any password. So as I  said, anyone who got access to your private key can now connect to the  server and execute arbitrary command without having to enter password.  That is the reason why you have to make sure your private key remain  private. You can as well limit the command that one can execute with the  couple of keys you are using to connect to the server (more information  &lt;a target="_blank" href="http://osdir.com/ml/linux.admin/2004-09/msg00022.html"&gt;here&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; Backup command&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Everything is now in place so let see how to backup your important  files. As I said earlier, we will use rsync to do that. You need rsync  on both sides, i.e. the machine you want to save files from and the  distant server. We previously installed cygwin and rsync on the computer  from which you want to backup file. I assume that your server is  running Linux and that your web host allows you to execute rsync (if you  have a SSH access to your server, you should as well have Rsync).&lt;/p&gt;
&lt;p&gt;And then, you just have to execute the following magic line to make your backup:&lt;/p&gt;
&lt;pre&gt;	rsync [options] -e "ssh -i .ssh/identity -p 22 -l username" /local/machine/repository/to/backup \&lt;br/&gt;	yoursite.com:/repository/where/you/want/your/backup&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Ok, maybe it is not clear enough so let say a few words about  it. First thing to know is that rsync comes with many many options. You  can read them all easily (man rsync). So we have to find adequate  options to do our backups. The first option to explain is the &amp;#8220;-e&amp;#8221; that  specify the remote shell to use. In our case, we just use the SSH access  that we have been created earlier.&lt;/p&gt;
&lt;p&gt;Then the other options will depend on what you want to do.&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;If you want to create a mirror of some of your directory, the following options should make the trick:&lt;/li&gt;
&lt;/ul&gt;&lt;pre&gt;	rsync -avz --delete -e "ssh -i .ssh/identity -p 22 -l username" /local/machine/repository/to/backup \&lt;br/&gt;	yoursite.com:/repository/where/you/want/your/backup	&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;-a is to archive the file,&lt;br/&gt; -v is the verbose option,&lt;br/&gt; -z is used to compress the files,&lt;br/&gt; &amp;#8212;delete is used to delete the file on the server if they have been  deleted on the local machine. If you omit this option, then you will do  an incremental backup of your files, meaning that everything that has  been to the server will remain on the server.&lt;br/&gt; /local/machine/repository/to/backup is the source&lt;br/&gt; yoursite.com:/repository/where/you/want/your/backup is the destination&lt;/p&gt;
&lt;li&gt;If you want to create daily backup so that if your files get  corrupted one day, you are able to restore them as they were the day  before, you would prefer:&lt;/li&gt;
&lt;pre&gt;	rsync -avz -e "ssh -i .ssh/identity -p 22 -l username" --link-dest=/repository/where/is/your/previous/backup \&lt;br/&gt;	/local/machine/repository/to/backup yoursite.com:/repository/where/you/want/your/backup&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;&amp;#8212;link-dest is used to create a full backup from the previous  location by using hard links. I will say more about it in the next  section.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; Scripts&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;It is time to put everything together now.  In order to do that, we  will create two little scripts. One on our machine that will contact the  server and send the files to it and the other one on the server to do  some post backup operations. The script that I will use here is based on  the second option, i.e. it will do a snapshot of your directory every  time you are calling it allowing you to go back in time to a previous  version whenever you have to. You should be able to copy paste the  script below, the only things you have to modify are the paths to the  files and the ssh parameters.&lt;/p&gt;
&lt;p&gt;Create a file backitup.sh that you will put in your user directory (local machine) and copy the following content in it:&lt;/p&gt;
&lt;pre&gt;#!/bin/bash&lt;br/&gt;# Script to be executed on the client side&lt;br/&gt;# Take the actual date and time &lt;br/&gt;date=`date "+%Y-%m-%dT%H:%M:%S"`&lt;br/&gt;# Execute the synchronisation &lt;br/&gt;rsync -avz --exclude-from=/path/to/files_to_exclude --link-dest=/path/to/current/backup -e "ssh -i .ssh/identity -p 22 -l username"  /cygdrive/c/Important/Family/Photos yoursite.com:/path/to/important/folder/backup-$date&lt;br/&gt;# Execute post backup command (in order to create correct shortcut to the current version)&lt;br/&gt;ssh -i .ssh/identity -p 22 -l username yoursite.com /path/to/post_backup.sh "$date"&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;This script will create a snapshot of an important folder of  your drive on your distant server. The path to the folder has to be  given according to cygwin rules. Your C:\ drive is accessible under  /cygwin/c/. If you want to save the folder Photos located in  C:\Important\Family\ you have two options:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;/cygdrive/c/Important/Family/Photos&lt;/li&gt;
&lt;li&gt;/cygdrive/c/Important/Family/Photos/&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;The final / will determine how files will be saved on the server. If  you omit it, all the subfolders of Photos will be copied and Photos will  be copied as well. If you put it, you will copy all the subfolders but  not Photos.&lt;/p&gt;
&lt;p&gt;Your files will be copied on the server in a folder containing the  date and time of the backup (given by the date attribute on the first  line of the script). In my case the path will look something like  /home/jimmy/backups/backup-2008-02-12T15:24:23. Depending on the choice  you have made previously the folder backup-2008-02-12T15:24:23 will  contain either just the Photos folder (and all subdirectories of course  will be under Photos) or will contain all the subdirectories of Photos.  The choice is yours.&lt;/p&gt;
&lt;p&gt;If you want to exclude some files from the backups, for example some  annoying system files or some hiden files, just add the  &amp;#8212;exclude-from=/path/to/files_to_exclude. Here is an example of a file  but for more options and information, just check the EXCLUDE PATTERNS  list available &lt;a target="_blank" href="http://www.ss64.com/bash/rsync.html"&gt;here&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;#RSync exclusion list&lt;br/&gt;# Usual system files (Windows, Mac, Linux)&lt;br/&gt;Thumbs.db&lt;br/&gt;.DS_Store&lt;br/&gt;.directory&lt;br/&gt;# Recycle bin to ignore&lt;br/&gt;.Trashes/&lt;br/&gt;Recycled/&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Finally, the option&lt;/p&gt;
&lt;pre&gt;--link-dest=/path/to/current/backup&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;is used so that we do not copy all the files each time we are  doing a backup. In fact, only new files will be sent to the server. If  files remained unchanged between two copies, then we will just create a  hard link to the file in the new backup (For more information, you can  visit one of the source of this article &lt;a target="_blank" href="http://blog.interlinked.org/tutorials/rsync_time_machine.html"&gt;here&lt;/a&gt;).  Be careful that in our case, the path to current backup is a path on  the server side. I will give more information about this in the next  script.&lt;/p&gt;
&lt;p&gt;Last line of the script is a connection to your server and is used to  execute the post_backup script explained below. It executes the script  and gives it an argument: the date of the backup. That&amp;#8217;s all for the  client side for now.&lt;/p&gt;
&lt;p&gt;Create a file post_backup.sh with the following content:&lt;/p&gt;
&lt;pre&gt;#!/bin/bash&lt;br/&gt;# Script to be executed on the server side &lt;br/&gt;echo "Execute the post back-up script on the server";&lt;br/&gt;# Delete previous current link (=shortcut to most recent version) if it exists&lt;br/&gt;if [ -d /path/to/current/backup ] ; then&lt;br/&gt;rm /path/to/current/backup ;&lt;br/&gt;echo "Previous shortcut deleted";&lt;br/&gt;fi ;&lt;br/&gt;#Create the new link with the date passed by the client&lt;br/&gt;# Check if we have the date of the last backup&lt;br/&gt;if [ $# -eq 1 ] ; then&lt;br/&gt;NEW_LINK=backup-$1;&lt;br/&gt;ln -s /path/to/important/folder/$NEW_LINK /path/to/current/backup;&lt;br/&gt;echo "Create new link to backup files";&lt;br/&gt;fi; &lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;This script does only two things. The first one is to delete  (if it exists) a shortcut that was linking to the latest previous  backup. The second one is to recreate this shortcut to make it link to  the backup we have just done. This script takes an argument, the date of  the latest backup. That&amp;#8217;s the argument the client give when executing  its last line. Once you have modified the script to suit your own needs,  send it to the server as you did before to send the public key and put  it in the right place, i.e. at the same place you specify on the client  script.&lt;/p&gt;
&lt;p&gt;Try to execute the script on the client side and verify the result on  the server. Once executed, you should find the folders you wanted to  backup, plus a shortcut pointing to the lastest backup. If you execute  it right after, it should be faster since almost no data will be sent to  the server. You will then have two copies, but the files will be only  once on the server. Deleting one of the backups does not affect the  others so you can clean your server regularly if you want to (to keep  only the 10 latest backup for example (I will probably do another post  about that later)).&lt;/p&gt;
&lt;p&gt;You now have an easy manual way to save your important file. You can  stop reading here if you are not interested to do that automatically.  The last section will create a windows job to execute it at a regular  time.&lt;/p&gt;
&lt;p&gt;[Edit] I have posted a &lt;a href="http://psykocybernetik.tumblr.com/post/909374294/ssh-restrictions"&gt;new message&lt;/a&gt; concerning SSH limitations that I have encountered while executing these commands. [/Edit]&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; Automatic task &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Alright, we are almost done. Last part will be to create a scheduled  task with windows or a cron job with linux. For the cron job, it&amp;#8217;s  pretty easy since you can execute the command directly. Just look for a  nice tutorial (for example&lt;a target="_blank" href="http://www.linux-tutorial.info/modules.php?name=MContent&amp;amp;pageid=78"&gt; this one&lt;/a&gt;)  and follow it. For windows, you just have to create a scheduled task  (accessible from the control panel) and make it execute the following  automatic_backup.bat&lt;/p&gt;
&lt;pre&gt;C:&lt;br/&gt;chdir C:\cygwin\bin&lt;br/&gt;bash --login -i ./backitup.sh&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;You can as well give the absolute path to the script file /cygwin/c/&amp;#8230;/backitup.sh.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt; References &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;That&amp;#8217;s it. We&amp;#8217;re done! I hope everything was clear enough. Here is a  list of some references that helped me do this tutorial (same links as  in the article):&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://blog.interlinked.org/tutorials/rsync_time_machine.html"&gt; Time Machine for every Unix out there &lt;/a&gt;&lt;br/&gt;&lt;a target="_blank" href="http://www.howtoforge.com/rsync_incremental_snapshot_backups"&gt; Creating Incremental Snapshot-style Backups With rSync And SSH&lt;/a&gt;&lt;br/&gt;&lt;a target="_blank" href="http://lifehacker.com/software/rsync/geek-to-live--mirror-files-across-systems-with-rsync-196122.php"&gt;Geek to Live: Mirror files across systems with rsync&lt;/a&gt;&lt;br/&gt;&lt;a target="_blank" href="http://www.perihel.at/3/index.html#rsync"&gt;RSync&lt;/a&gt;&lt;br/&gt;&lt;a target="_blank" href="http://www.mikerubel.org/computers/rsync_snapshots/"&gt;Easy Automated Snapshot-Style Backups with Linux and Rsync&lt;/a&gt;&lt;br/&gt;&lt;a target="_blank" href="http://www.linuxtutorialblog.com/post/ssh-and-scp-howto-tips-tricks"&gt;SSH and SCP: Howto, tips &amp;amp; tricks&lt;/a&gt;&lt;br/&gt;&lt;a target="_blank" href="http://sial.org/howto/rsync/"&gt;rsync Tips &amp;amp; Tricks&lt;/a&gt;&lt;br/&gt;&lt;a target="_blank" href="http://www.linux.com/articles/34958"&gt;Using key-based authentication over SSH&lt;/a&gt;&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909365003</link><guid>http://psykocybernetik.com/post/909365003</guid><pubDate>Sat, 09 Feb 2008 02:37:00 +0100</pubDate><category>ssh</category><category>backup</category><category>rsync</category></item><item><title>Restricted Access</title><description>&lt;p&gt;I am sure that you have already seen some dialog like that:&lt;/p&gt;
&lt;p&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u89xZZgS1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p&gt;This kind of dialog appears when a folder is protected on an Apache  server. It allows some files to be accessible to a limited amount of  people with special rights. This kind of protection is done by a little  file: &amp;#8220;.htaccess&amp;#8221; put in the directory containing the content to  protect.&lt;/p&gt;
&lt;p&gt;I will give here a basic example about the use of such a file. Let  say that you have installed a proxy on your server (as we did &lt;a title="Create a proxy" href="http://psykocybernetik.tumblr.com/post/909340042/create-proxy"&gt;here&lt;/a&gt;)  but you don&amp;#8217;t want every single user of your website to be able to  access it (after all, it can use a lot of bandwidth). In that case, you  would put a .htaccess file in the same directory than the proxy script  and you will be the only one able to access the proxy you have  installed.  Let&amp;#8217;s get started.&lt;/p&gt;
&lt;p&gt;The first thing to do is to create the .htaccess file and to copy the following into it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;AuthType Basic&lt;br/&gt;AuthName "Password Required"&lt;br/&gt;AuthUserFile /www/passwords/password.file&lt;br/&gt;Require valid-user&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Each field is pretty easy to understand:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;AuthType give the type of htaccess file&lt;/li&gt;
&lt;li&gt;AuthName is the name that will appear in the dialog that will open (&amp;#8220;Scripts&amp;#8221; in the screenshot above)&lt;/li&gt;
&lt;li&gt;AuthUserFile is a file containing the list of valid users and their password.&lt;/li&gt;
&lt;li&gt;Require indicates who will be allowed to connect (in the case above,  every valid user but you can limit that to only one by specifying the  name)&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;The second step of the process is to create the password file  containing the users allowed to log in (you can give it the name you  want but many people name it .htpasswd). This is simply a list looking  like that:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;user1:pass1 &lt;br/&gt; user2:pass2 &lt;br/&gt; ... &lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For a better security (i.e. to prevent people to actually be able to  see your password if they can access the password file on your computer  for example), the password should be encrypted. You can go &lt;a title="Encrypt password" target="_blank" href="http://www.kxs.net/support/htaccess_pw.html"&gt;here&lt;/a&gt; to encrypt your password. Finally, you just have to transfer the two  files to your server. Remember that the .htaccess file has to go to the  same directory than the content you are trying to protect. The file  containing the password can go anywhere but you will have to put it at  the same place that you specify in the .htaccess file.&lt;/p&gt;
&lt;p&gt;Htaccess allows a lot more than just protecting folder with password. For more information, you can go &lt;a title="htaccess on apache" target="_blank" href="http://httpd.apache.org/docs/1.3/howto/htaccess.html"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909354388</link><guid>http://psykocybernetik.com/post/909354388</guid><pubDate>Wed, 30 Jan 2008 23:33:00 +0100</pubDate><category>htaccess</category></item><item><title>Create a proxy</title><description>&lt;p&gt;I guess that you have already been in a  situation where you couldn&amp;#8217;t access some websites whether you are at  school, work, library, or in some country that practices censure.&lt;/p&gt;
&lt;p&gt;There are many &lt;a target="_blank" href="http://www.4fifteendesign.com/list-of-370-working-proxys/"&gt;proxies&lt;/a&gt; (thanks &lt;a target="_blank" href="http://www.korben.info/une-bonne-grosse-liste-de-proxy-pour-acceder-au-net-sans-censure.html"&gt;Korben&lt;/a&gt; for the info) that you can use to bypass these limitations but they can  be slow and / or with a lot of ads and pop-up windows. But if you have  your own web hosting, there is an easy way to avoid these drawbacks:  install your own proxy&lt;sup&gt;1&lt;/sup&gt;. In order to do so, you simply need:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;A web hosting that allows you to execute cgi scripts.&lt;/li&gt;
&lt;li&gt;The &lt;a title="CGIProxy website" target="_blank" href="http://www.jmarshall.com/tools/cgiproxy/"&gt;CGIProxy script&lt;/a&gt; written by James Marshall, available &lt;a title="CGIProxy script" href="http://www.jmarshall.com/tools/cgiproxy/releases/cgiproxy.2.0.1.tar.gz"&gt;here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;Installation is pretty straightforward but here are a few words about  it. The first thing is to identify where your server allows you to put  PERL scripts. In most cases it is probably in the cgi-bin directory at  the root of your website but for what I have read some web hosters allow  you to put it anywhere.  The second thing is to identify the PERL path  and modify the first line of the file you have dowloaded according to  this information. If you can access your webhosting through CPanel, look  at the bottom of the home page and you may see something like &amp;#8220;Perl  Path: /usr/bin/perl&amp;#8221;&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u8d8dsLW1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p&gt;&lt;span id="right"&gt;If you have an SSH access, you can also try the  command &amp;#8220;which perl&amp;#8221;. Most of the time, the path is the one given above  or the one coming with the file. &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Once you have transfered the nph-proxy.cgi to your server in the  correct directory, you should be able to access it and see something  like that:&lt;/p&gt;
&lt;p class="rtecenter"&gt;&lt;img src="http://media.tumblr.com/tumblr_l6u8e5uPeG1qcbewf.png"/&gt;&lt;/p&gt;
&lt;p&gt;Don&amp;#8217;t hesitate to read the documentation on the author website since  many options exist to customize your proxy. You can restrict access to  some websites, ban some IP addresses to limit access to your proxy,  customize the header of the pages accessed trough your proxy, etc&amp;#8230;&lt;/p&gt;
&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; Of course, your website shoudn&amp;#8217;t been blocked itself so  that you can use it as a proxy. You can try to see if you can access  your website from China &lt;a title="Test China firewall" target="_blank" href="http://www.websitepulse.com/help/testtools.china-test.html"&gt;here&lt;/a&gt;.&lt;/p&gt;</description><link>http://psykocybernetik.com/post/909340042</link><guid>http://psykocybernetik.com/post/909340042</guid><pubDate>Mon, 28 Jan 2008 22:18:00 +0100</pubDate><category>proxy</category></item></channel></rss>

