Debian: paste with mouse in vi

systems No Comments »

Ever wondered why vi(m) automatically inserts tabs on each line you paste using your mouse with middle-click (and with each line more an additional tab gets added)?

This has been annoying me for years, so I finally went and started searching for a solution. In the end it’s oh-so simple. When you are in vi, enter “:set paste” before you insert something into a buffer with your mouse middle-click. Interestingly Debian seems to be the only distribution where this is off by default.

vi: replace newline

systems No Comments »

In order to replace a newline character in vi, say by the string “, ” the following command should do while being in vi:
:%s/\n/\,\ /g

OpenVPN, SSH and DSL lines

networking, security No Comments »

Setting

A few virtual servers were set up for one of our customers and to improve security we only publicly allowed HTTP/HTTPS and OpenVPN. So the customer would have to vpn in before a SSH session could be established. So far so good…

Customer is able to happily vpn in from multiple clients and open SSH sessions to do his work until… well until he actually dared to transfer a file to one of the servers using WinSCP/PSCP (sftp -> scp fallback). Now whenever an attempt was made to transfer a file he received:

Read error from remote host a.b.c.d: Connection reset by peer

So we went ahead and investigated possible causes for this error by initially following the “user error” path. But neither the WinSCP client nor pscp.exe were able to successfully transfer a file. We finally experimented with file sizes and found out that files smaller than 4kb were actually being transferred without a problem…

Furthermore we were also able to successfully transfer files of “any” size (we test up to 30MB) from another server that was connected via a second OpenVPN server. Also ICMP tests showed no connection drops or apparent latency issues. So it could not be an OpenVPN issue itself but rather something protocol related. Our first guess was the MTU size because SSH debug output showed a successful key exchange and a drop of the connection as soon as data was going to be transferred and our customer connects via an ADSL link.

So we added the following options to both the OpenVPN server and client configuration:

tun-mtu 1500
fragment 1300
mssfix

And voilá, copying files via SSH works like a charm now.

Debian: set static route

systems No Comments »

Static routes would be configured in /etc/network/interfaces in the section for the respective network adapter:

iface eth1 inet static
address 192.168.14.80
netmask 255.255.255.0
network 192.168.14.0
broadcast 192.168.14.255
up route add -net 10.10.1.0 netmask 255.255.255.0 gw 192.168.14.82
down route del -net 10.10.1.0 netmask 255.255.255.0 gw 192.168.14.82

NFS: mount options

systems 1 Comment »

To optimize NFS throughput and speed the following mount options could help:

rw,noatime,rsize=32768,wsize=32768,soft

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in