Tag Archives: aws ec2

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.

XFS in AWS EC2 for MongoDB. The easy way

Changing the filesystem on AWS EC2 is a difficult task. The easy way to use XFS filesystem on AWS EC2 for hosting MongoDB is to add an extra block storage and format it as XFS

  • First create a Block Storage and attach.
  • Provisioned IOPS SSD is a suitable one for high volume data flow.
  • Once the block storage is attached, then use the command prompt or terminal to format the disk as XFS and mount
    1. apt-get update
    2. apt-get upgrade
    3. lsblk —- to view the attached block device and confirm
    4. file -s /dev/nvme1n1 — to check if there is a filesystem already there or not. if there is no filesystem then it will return “device” . Else it will show something like this “/dev/nvme1n1: SGI XFS filesystem data (blksz 4096, inosz 512, v2 dirs)”.
    5. mkfs -t xfs /dev/nvme1n1 —– command to format the disk with XFS filesystem
    6. apt-get install xfsprogs –— command to install xfs tools
    7. mkdir /mongodata
    8. mount /dev/nvme1n1 /data
    9. mount /dev/nvme1n1 /mongodatabases/
    10. cp /etc/fstab /etc/fstab.orig
    11. blkid —– to check the UUID of the block device added
    12. nano /etc/fstab —– and add the device like this UUID=7xxf03xx-6xxx-4xxx-9xxx-exxxxff2xxxxf /mongodatabases xfs defaults,nofail 0 2
    13. umount /mongodatabases/ —– unmount and mount -a to check fstab entry
    14. mount -a
    15. reboot — I did a double check by rebooting and checked if the disk is still attched and the mounted
    16. df -h
    17. lsblk
    18. mount