keep alive for sftp

keep alive for sftp

Postby firwareslut » Wed May 16, 2012 9:32 am

Anyway to stop the sftp auto disconnecting after inactivity?

I am trying to keep my sshfs mount alive but I can't figure it out.

I tried putting ServerAliveInterval 5 in /etc/ssh_config on the client side but it makes no difference.
firwareslut
Donator VIP
Donator VIP
 
Posts: 202
Joined: Thu Oct 06, 2011 11:53 am

Re: keep alive for sftp

Postby Jocko » Wed May 16, 2012 2:35 pm

Hi firmwareslut,

you can't easily change it, in the proftpd conf file (see my previous post). I think that the better way is to create an additional virtual server.

You can do this by using the option "Additional Settings File" in the setup menu.

So, create a file where you want and custom these lines :
Code: Select all
<IfModule mod_sftp.c>
   <virtualhost HERE YOUR NAS IP(lan)>

   TimeoutSession      0
   TimeoutIdle             0
   TimeoutStalled         0

      SFTPEngine      on
      SFTPLog         /tmp/var/log/proftpd/proftpd.log

      # Configure the server to listen on the normal SSH2 port,
      Port         HERE YOUR SFTP PORT
      
      # Configure both the RSA and DSA host keys, using the same host key
      # files that dropbear uses.
      SFTPHostKey      /rw_fs/etc/dropbear/dropbear_rsa_host_key_openssh
      
      #use UTF8 for all SFTP protocol versions and all clients.
      SFTPClientMatch .* sftpUTF8ProtocolVersion 3
      
      #Only support SFTP protocol version 1 through 3 for WinSCP and CuteFTP
      SFTPClientMatch WinSCP|ClientSftp sftpUTF8ProtocolVersion 3
      
      #Fix channel size for CoreFTP can not support normal channel 4GB
      SFTPClientMatch CoreFTP channelWindowSize 1GB
      
      #Fix channel size for Axway SFTP clients can not support normal channel 4GB
      SFTPClientMatch .*Axway channelWindowSize 1GB
      
      # JSch - Java Secure Channel (SSH-2.0-JSCH-0.1.39)
      SFTPClientMatch "JSCH.*" channelWindowSize 1GB
      
      #Fix for FireFTP SFTP clients
      SFTPOptions PessimisticKexinit
      
      #Allow the same number of authentication attempts as Dropbear.
      MaxLoginAttempts   5
      
      <Limit LOGIN>
         Order deny,allow
         Allow HERE LIST OF YOUR AUTHORIZIED IP (WAN or LAN) LIKE : 192.168.2.100 192.168.2.41
      </Limit>
   </virtualhost>
</IfModule>


With these timeout values, you should keep the connexion opened. Warning, if a connexion is not closed properly, no timeout will do it and you must restart the server to reset the hanged connexion.

---edit---
You mustn't use a port already set for another daemon and of course this one used by dropbear
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France


Return to Lacie Network Space vs2 and max version

Who is online

Users browsing this forum: No registered users and 5 guests