Setting up a backup space for

On the test went into, has opened Main functions – Servers, selected the server and in the tab Backup activated free 100GB, since for servers costing 39 € or more this place was allocated for free.
Activated WebDAV to test, samba was already activated, it is also possible to connect via FTP, FTPS, SFTP and SCP using a user name and password, via SFTP/SCP, you can also connect using the key.
The speed of data transfer to the backup server depends on the number of connected users and their traffic.
When connecting, use a domain name, for example, because the IP address can change.
Also, you can not create the /etc and /lib directories in place for backups.

For an example in Ubuntu Server, I will mount a backup location using SAMBA/CIFS.
Install the necessary utilities and create a directory in which we will mount:

sudo apt-get install cifs-utils
sudo mkdir /backup

Temporarily mount the place with the command:

sudo mount.cifs -o user=USER,pass=PASSWORD // /backup

To automatically mount after rebooting the system, add the following line to the / etc / fstab file:

// /backup   cifs  iocharset=utf8,rw,credentials=/etc/backup-credentials.txt,uid=SYSTEM_USER,gid=SYSTEM_GROUP,file_mode=0660,dir_mode=0770 0 0

To open a file it is possible for example with the text editor nano (CTRL+X for an output, y/n for saving or canceling changes):

sudo nano /etc/fstab

And add the following lines to the file /etc/backup-credentials.txt:


We will only set permissions for the file owner for security reasons:

sudo chmod 600 /etc/backup-credentials.txt

If you use the Windows operating system, you need to create a system user with the same login and password as the backup location.

Now I will connect to the test via WebDAV.
Install the necessary utilities and create a directory in which we will mount:

sudo apt-get install davfs2
sudo mkdir /backup

In CentOS:

yum install davfs2
mkdir /backup

Temporarily to mount through WebDAV a place it is possible a command:

sudo mount -t davfs /backup

To automatically mount after rebooting the system, add the following line to the /etc/fstab file: /backup davfs rw,uid=SYSTEM_USER,gid=SYSTEM_GROUP,file_mode=0660,dir_mode=0770 0 0

And in the file /etc/davfs2/secrets the following line: USER PASSWORD

That’s all, in my case, you can save backups to the /backup directory.

Installing and configuring ownCloud

ownCloud – Web application for synchronization, sharing and remote storage of data in the “cloud”.

Perform the installation of ownCloud for example in Ubuntu:

sudo apt-get install owncloud

I noticed that in Ubuntu, at the time of installation I tested on Ubuntu 14.04.03 LTS, canceled the installation of ownCloud from the repository, so you can add a third party and install or update from it. We look at the sources

On Ubuntu 14.04, for example, installation from a third-party repository is performed by the following commands:

sudo sh -c "echo 'deb /' >> /etc/apt/sources.list.d/owncloud.list"
sudo apt-get update
sudo apt-get install owncloud

The next step is to open the web interface http://server/owncloud in the browser and create the login and password for the administrator account, as well as specify the type of database to store the settings, accounts and other information owncloud.
For better performance, it’s better to use the mysql database, for this we will install the MySQL server and create it:

sudo apt-get install mysql-server
mysql -u root -p
create database owncloud;
grant all privileges on owncloud.* to owncloud@localhost  identified by 'ПАРОЛЬ';

To be able to upload large files into owncloud, you will need to edit /etc/php5/apache2/php.ini by changing the upload_max_filesize and post_max_size in it, for example to 2048mb.

See also:
Install Nextcloud in Ubuntu

Allow insecure connections to POP3 / IMAP iRedMail

In order to be able to connect to POP3 / IMAP without STARTTLS, you need to open the Dovecot configuration file:

sudo nano /etc/dovecot/dovecot.conf

Edit the two parameters listed below:


To return the parameters of the secure connection to POP3S / IMAPS back:


After the changes in the Dovecot configuration, you need to restart it:

sudo /etc/init.d/dovecot restart

See also:
How to enable SMTP without SSL on port 25 in iRedMail / Postfix

Ubuntu IP Masquerading (NAT)

For example, I will configure IPv4 masquerading (NAT) on Ubuntu Server.
First you need to enable packet forwarding in /etc/sysctl.conf so that traffic can walk between different network interfaces.
Let’s check the current status:

sysctl net.ipv4.conf.all.forwarding
cat /proc/sys/net/ipv4/ip_forward

If it is 0, then enable it with the following command:

sysctl -w net.ipv4.conf.all.forwarding=1

To keep this after the system restart, open the file /etc/sysctl.conf for example in the nano editor (Ctrl + X to exit, y / n to save or discard changes):

nano /etc/sysctl.conf

And add the line:


If necessary, you can clear existing NAT rules:

iptables -t nat --flush

Now it remains to add a rule to iptables, for example:

iptables -t nat -A POSTROUTING -s -j SNAT --to-source

Where, internal network, and the address through which you need to go to the Internet, similarly prescribed other internal networks.
Let me remind the mask for private networks:

If the IP address on the external network interface changes (dynamic), then instead of SNAT we specify MASQUERADE:

iptables -t nat -A POSTROUTING -s -j MASQUERADE

Do not forget to save the added iptables rules.
For example, you can open the network interface configuration file (its contents are loaded at system startup):

nano /etc/network/interfaces

And at the end add iptables rules, for example I will indicate the masquerading of this network at once to several IP addresses, and also with the indication of the network interface:

post-up /sbin/iptables -t nat -A POSTROUTING -s -o eth3 -j SNAT --to-source --persistent

Or add to the file:

nano /etc/rc.local
/sbin/iptables -t nat -A POSTROUTING -s -o eth3 -j SNAT --to-source --persistent

I recommend to specify the outgoing network interface, if you do not specify it, then local traffic will return to the network under NAT IP.
If there are several outgoing interfaces, let’s say the load is balanced through BGP, etc., then we indicate with two rules:

/sbin/iptables -t nat -A POSTROUTING -s -o eth3 -j SNAT --to-source --persistent
/sbin/iptables -t nat -A POSTROUTING -s -o eth4 -j SNAT --to-source --persistent

See also my articles:
Difference between MASQUERADE and SNAT
Configuring IPTables
How to fix the error “nf_conntrack: table full, dropping package”
Using Linux ISG

Installing ISC DHCP for ABillS

Here is an example of the installation of the ISC DHCP server for ABillS in Ubuntu Server.

Switch to the root user:

sudo su

Install package:

apt-get install isc-dhcp-server
ln -s /usr/abills/Abills/modules/Dhcphosts/ /usr/abills/libexec/


/usr/abills/libexec/ -d LEASES=/var/lib/dhcp/dhcpd.leases

Change owner of a file:

chown www-data /etc/dhcp/dhcpd.conf

Open the in the Editor:

nano /usr/abills/libexec/

Add options:

$conf{DHCPHOSTS_RECONFIGURE}='/usr/bin/sudo /etc/init.d/isc-dhcp-server restart';

Open in the Editor:

nano /etc/sudoers

Add the string making the ability to run a service system:

www-data   ALL = NOPASSWD: /etc/init.d/isc-dhcp-server

Go to the Abills Web interface, open the menu "settings"-"IP (DHCP)"-"Network IP (DHCP) Network", add the network if needed, then "Show, reconfigure the dhcp" and "Reconfigure".

See if the isc-dhcp-server command:

/etc/init.d/isc-dhcp-server status

Logs are written to the file/var/log/syslog

You can also configure the export of DHCP history to see it in the “Report” – “DHCP History” menu.
To do this, make a link:

ln -s /usr/abills/Abills/modules/Dhcphosts/ /usr/abills/libexec/

Separating DHCP logs into a separate file as I wrote in the article below and adding to the Startup script with the command:

tail -F /var/log/dhcpd.log | /usr/abills/libexec/

See also my articles:
Installing and configuring a dhcp server, isc-in Ubuntu
Packet capturing with tcpdump