Monthly Archives: January 2021

ISPConfig 3 Showing Default Site

After a fresh install of ISPConfig 3 I added some site. Now the strange problem was HTTP version was always opening the default Apache page. But the HTTPS version was opening the proper site.

Solution:

Disable the default website

a2dissite 000-default.conf
The reason for HTTP version opening default site and HTTPS opening proper site:

When Apache is installed it installs a default website (normally /etc/apache2/sites-enabled/000-default.conf). This default website doesn’t have any HTTPS version, only the HTTP version is installed.

Now when the HTTP version of my site was being requested it was opening the HTTP version of the default site as the HTTP version was existing. But as there was no HTTPS version of the default site so when the HTTPS version  of my site was being called no default site was matching and hence it opened the proper site.

Pure-FTPd Error on Amazon EC2

Pure-FTPd error “500 I won’t open a connection to <IP ADDRESS>” OR “Server sent passive reply with unroutable address. Using server address instead.

This happens when the server is beyond a NAT like the Amazon EC2. The most posted solution on the internet is to fallback to “Passive” mode in the FTP client. But in my case that didn’t help and still I got the same error. After more digging found the solution.

Need to create two files ForcePassiveIP and PassivePortRange and put the port range and the Public IP of the server.

echo "40110 40210" > /etc/pure-ftpd/conf/PassivePortRange 

echo "1.2.3.4" > /etc/pure-ftpd/conf/ForcePassiveIP

1.2.3.4 is the external IP address of the EC2 instance.

Didn’t make any changes to /etc/pure-ftpd/pure-ftpd.conf. Specially didn’t restrict or set the “IPv4 Only “. With IPv4 only I face problems with some internet connections which uses IPv6.

Settings for FileZilla

Encryption: require explicit FTP over TLS
Transfer mode: Passive (PASV)

Restart Pure-FTPd. The command may vary based on which package has been used.

service pure-ftpd-mysql stop
service pure-ftpd-mysql start

Hope this helps someone.

Adding a second disk and quota in Amazon EC2

This article is based on Ubuntu 20.04.

AWS has good documentation on how to create and add the disk to the instance so not mentioning those steps here.

Once the disk is added to the system verify that it is added and what is the name it is being shown as.

Steps for adding the disk to the system – that is making it ready for mounting

  1. lsblk  --- to check the disk has been added and the name
  2. mkfs -t ext4 /dev/<disk name>    --- Please Note - xfs disks gives error when quota options are added in the fstab files. e.g - mkfs -t ext4 /dev/nvme1n1
  3. mount /dev/<disk name> <mount point>  ---  e.g - mount /dev/nvme1n1 /data
  4. blkid --- check the UUID of the disk
  5. Add entry to fstab
    
    UUID=axxf131c-xxxx-xxxx-8xxx-ec978dxxxxxx /data ext4 defaults,nofail 0 2
    
    Replace /data with your mount point name
    
    nofail will ensure that the system boots even if the disk mounting fails (like when disk removed)
  6. umount <mount point>  ---  umount /data
  7. mount -a  --- Please note - wrong entry in the fstab can make the system unbootable. So please ensure that there are no errors. And don't reboot without resolving errors.  

 

Now the steps for turning on Quota

  1. mount -o remount <disk partition>  e.g - mount -o remount /data
  2. quotacheck -avugm
  3. quotaon -avug
  4. Edit the fstab file and add the necessary
    • nano /etc/fstab
    • add the following to the end of the existing parameters ,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0
    • Save the file
    • Please note - wrong entry in the fstab file can make the system unusable. Please check the file first before rebooting.  Use mount -a to check if the entries in fstab file is good.

Example:

Disk Quota on Amazon EC2

The Linux AMIs available for AWS EC2 may not have the packages required for activating Disk Quota.

This article is based on Ubuntu 20.04.

There are many articles and suggestions on the internet. Following one of the suggestions caused my system to become read-only. Lastly found a solution which looks the most legit, simple and works perfect.

It needs installation of the package “linux-modules-extra-aws

  1. apt-get install linux-modules-extra-aws
  2. apt-get -y install quota quotatool
  3. mount -o remount <disk partition>  e.g - mount -o remount /
  4. quotacheck -avugm
  5. quotaon -avug
  6. Edit the fstab file and add the necessary
    • nano /etc/fstab
    • add the following to the end of the existing parameters ,usrjquota=quota.user,grpjquota=quota.group,jqfmt=vfsv0
    • Save the file
    • Please note - wrong entry in the fstab file can make the system unusable. Please check the file first before rebooting.  Use mount -a to check if the entries in fstab file is good.