<!-- **********************************************************************
  copyright            : (C) 2000-2019
                         Rafi Yanai, Shie Erlich, Frank Schoolmeesters
                         & the Krusader Krew
  e-mail               : krusader-devel@googlegroups.com
  web site             : https://krusader.org
  description          : a Krusader Documentation File

***************************************************************************
* Permission is granted to copy, distribute and/or modify this            *
* document under the terms of the GNU Free Documentation License,         *
* Version 1.1 or any later version published by the Free Software         *
* Foundation; with no Invariant Sections, no Front-Cover Texts and        *
* no Back-Cover Texts.  A copy of the license is available on the         *
* GNU site https://www.gnu.org/licenses/fdl.html or by writing to:        *
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,    *
* MA 02111-1307, USA.                                                     *
*********************************************************************** -->
<sect1 id="remote-connections">
  <title>Remote Connections</title>
  <indexterm>
    <primary>Remote Connections</primary>
  </indexterm>
  <para>Remote connections are easily made by typing the
  &URL; in the 
  <link linkend="list_panel">Location Toolbar</link>; these are
  actually KIO Slaves. Please note that the
  &krusader; panel does not support all
  KIO Slave &eg; 
  <command>http://</command> will not work in the panel, but will
  work in the 
  <link linkend="krviewer">viewer</link>. Some examples:</para>
  <itemizedlist>
    <listitem>
      <para>
        <userinput>
          <command>ftp://</command><replaceable>public.ftpserver.org/directory/</replaceable>
        </userinput>
      </para>
    </listitem>
    <listitem>
      <para>
        <userinput>
          <command>fish://</command><replaceable>username@hostname/</replaceable>
        </userinput>
      </para>
    </listitem>
    <listitem>
      <para>
        <userinput>
          <command>sftp://</command><replaceable>username:password@sftp.foo.org/</replaceable>
        </userinput>
      </para>
    </listitem>
    <listitem>
      <para>
        <userinput>
          <command>ftp://</command><replaceable>username@my.server.org:21/directory/</replaceable>
        </userinput>
      </para>
    </listitem>
    <listitem>
      <para>
        <userinput>
          <command>smb://</command><replaceable>username:password@server/share</replaceable>
        </userinput>
      </para>
    </listitem>
    <listitem>
      <para>
        <userinput>
          <command>ftp://</command><replaceable>username@proxyusername:password@proxipassword@hostname/directory</replaceable>
        </userinput>
      </para>
    </listitem>
    <listitem>
      <para>
        <userinput>
          <command>nfs://</command><replaceable>&lt;host&gt;:&lt;port&gt;&lt;url-path&gt;</replaceable>
        </userinput>
      </para>
    </listitem>
    <listitem>
      <para>
        <userinput>
          <command>webdav://</command><replaceable>www.server.com/path/</replaceable>
        </userinput>
      </para>
    </listitem>
  </itemizedlist>
  <para>You can bookmark these &URL;s, however, please
  read the 
  <link linkend="bookman">Bookman</link> section regarding 
  <emphasis>securely save passwords</emphasis>. For connecting to
  multiple locations, bookmark these &URL;s and open
  them one by one, or open them all together by using
  <link linkend="panel_profiles">Panel profiles</link>. To switch from one to another
  location, just open a <link linkend="folder-tabs">Folder tabs</link> for
  each.</para>
  <para>There are three ways to start a remote connection:</para> 
  <itemizedlist>
    <listitem>
      <para>Type the &URL; in the 
      <link linkend="list_panel">Location Toolbar</link></para>
    </listitem>
    <listitem>
      <para>Select 
        <menuchoice>
          <guimenu>Tools</guimenu>
          <guimenuitem>New Net Connection</guimenuitem>
        </menuchoice>
      which will pop-up a dialog that will ask for the
      remote site details. This dialog is handy if you are not used
      to type remote &URL;s in the Location Toolbar.
      Leaving the password and user name fields empty will log you
      in as anonymous. Note: we are planning to rewrite this dialog
      window.</para>
    </listitem>
    <listitem>
      <para>You can bookmark a directory on a remote host and
      return to this directory from the bookmark button on the top
      corner of your panel just like in a web browser.</para>
    </listitem>
  </itemizedlist>
  <para>After you log on to a remote server you can browse it just
  like your local hard drive with the following exceptions:</para> 
  <itemizedlist>
    <listitem>
      <para>You cannot execute files on remote servers.</para>
    </listitem>
    <listitem>
      <para>Permissions cannot always be calculated on remote
      servers (depends on server and access method) so you might
      get a <guilabel>?</guilabel> on the permissions columns for some files.</para>
    </listitem>
    <listitem>
      <para>Disk usage information is not available for most remote
      filesystems.</para>
    </listitem>
  </itemizedlist>
  <para>To change the charset of the remote host use 
    <menuchoice>
      <guimenu>View</guimenu>
      <guimenuitem>Select Remote Charset</guimenuitem>
    </menuchoice>
  .</para>
  <para>You can close the current Active Remote
  Connection by two separate methods:</para> 
  <itemizedlist>
    <!--
        <listitem>
           <para>Manually: <emphasis role="bold"><menuchoice><guimenu>Commands</guimenu>
                 <guimenuitem>Disconnect From Net</guimenuitem></menuchoice></emphasis></para>
        </listitem>
        -->
    <listitem>
      <para>Manually: Add the disconnect button to the
      <link linkend="mainwindow">Main Toolbar</link> and click on it.</para>
    </listitem>
    <listitem>
      <para>Automatically: Change the &URL; in the
      <link linkend="list_panel">Location Toolbar</link> .</para>
    </listitem>
  </itemizedlist>
  <note>
    <para>&krusader; is a file manager that supports
    remote connections via KIO Slaves, but if you
    are looking for even more advanced remote connections features,
    &eg; an advanced &FTP; client we
    recommend you to use &eg;
    <ulink url="https://lftp.yar.ru/">LFTP</ulink> or
    <ulink url="https://filezilla-project.org/"><application>FileZilla</application></ulink>.</para>
  </note>

<sect2 id="remote-connections-lan-fish">
  <title>LAN connections via fish:/ protocol (zeroconf)</title>
  <indexterm>
    <primary>Remote LAN Connections (zeroconf)</primary>
  </indexterm>

<para>This section is contributed by Andrew Svet (z-vet),
      feedback about this chapter is appreciated. Thanks!</para>

 <note>
   <para>This works on a <trademark class="registered">Debian</trademark> system, so it will work on <trademark class="registered">Debian</trademark> and derivatives (<trademark class="registered">Kubuntu</trademark> &etc;), though
   it should work on other Linuxes as well. 
   We assume that you have <link linkend="gloss-ssh">SSH</link> installed, configured and working on 
   every machine on LAN you want to connect to/from.
   There are plenty of very good tutorials about <link linkend="gloss-ssh">SSH</link> on the net, &eg;
   at <ulink url="http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch17_:_Secure_Remote_Logins_and_File_Copying">linuxhomenetworking.com</ulink> 
   or just google for it.  We use the default <link linkend="gloss-ssh">SSH</link> port (22) for this chapter.
   Remember to change it if you use different one. All modifications, editing &etc; must be done as root. 
   </para>
 </note>

<para>
Let's start with installing all the packages we need: 
<screen>
<prompt>#</prompt> <userinput><command>apt-get install</command> <option>avahi-daemon libnss-mdns kdnssd</option></userinput>
</screen>

Everything is installed, now let's do some configuration. First, we need our services to be announced on LAN.
That is why we installed avahi-daemon: it represents your machine on local network and allows other applications 
to publish services they provide. Avahi-daemon comes with example <filename>ssh.service</filename> configuration 
file found in <filename class="directory">/usr/share/doc/avahi-daemon/examples</filename>. In order to get the service to be 
announced on LAN we need to copy this file to <filename class="directory">/etc/avahi/services</filename> directory: 
<screen>
<prompt>#</prompt> <userinput><command>cp</command> <option>/usr/share/doc/avahi-daemon/examples/ssh.service /etc/avahi/services</option></userinput>
</screen>

Now we need fish:/ protocol to be announced too, so we use an ssh.service file as a template for fish.service: 
<screen>
<prompt>#</prompt> <userinput><command>cp</command> <option>/etc/avahi/services/ssh.service /etc/avahi/services/fish.service</option></userinput>
</screen>

This file is just a copy of ssh.service. Edit the <filename>fish.service</filename> file and replace 
"Remote Terminal on %h" with "Fish to %h" and "_ssh._tcp" with "_fish._tcp". 

Here is how it looks after edit:
<programlisting> 
&lt;?xml version="1.0" standalone='no'?&gt;&lt;!--*-nxml-*--> 
&lt;!DOCTYPE service-group SYSTEM "avahi-service.dtd"&gt;

&lt;!-- $Id: remote-connections.docbook,v 1.6 2007/05/02 18:07:28 codeknight Exp $ --> 

&lt;!-- 
  This file is part of avahi. 
  
  avahi is free software; you can redistribute it and/or modify it 
  under the terms of the GNU Lesser General Public License as 
  published by the Free Software Foundation; either version 2 of the 
  License, or (at your option) any later version. 

  avahi is distributed in the hope that it will be useful, but 
  WITHOUT ANY WARRANTY; without even the implied warranty of 
  MERCHANTABILITY or FITNESS FOR 

&lt;!-- See avahi.service(5) for more information about this configuration file --> 

&lt;service-group> 

  &lt;name replace-wildcards="yes">FISH to %h&lt;/name> 

  &lt;service> 
    &lt;type>_fish._tcp&lt;/type> 
    &lt;port>22&lt;/port> 
  &lt;/service> 

&lt;/service-group>  
</programlisting>
Save the modified file. 

Now we need to create a new file <filename>_fish._tcp</filename>, open a text editor and add the next lines:
<programlisting>
Name=FISH Protocol (ssh) 
Type=_fish._tcp 
UserEntry=u 
PathEntry=path 
PasswordEntry=p
</programlisting> 
And save the file <filename>/usr/share/apps/zeroconf/_fish._tcp</filename>

Do the same on each machine on your LAN, then restart avahi-daemon: 
<screen>
<prompt># /etc/init.d/</prompt> <userinput><command>avahi-daemon</command> <option>restart</option></userinput>
</screen>

Then open &krusader; and type in location-toolbar-lnk: <filename>zeroconf:/</filename> to open the  
<link linkend="gloss-zeroconf">zeroconf</link> connection.
Enter the <guilabel>Fish Protocol</guilabel> directory. Inside you will find the links to each machine that 
announced <filename>fish:/</filename> on your LAN, the location-toolbar-lnk: will point to 
<filename>zeroconf:/_fish._tcp</filename> Double clicking on any of these machines,
them will bring up the password prompt, asking you for your ssh key passphrase (if password was set). 
Enter your passphrase. Congratulations: you connected to remote machine using &krusader;!
</para> 

</sect2>

</sect1>


