Thank you Mat for correction - you are completely right!
It's not a minor bug, heh... I didn't pay attention to this obvious fact - 
shame on me((
But now everything should be fine.
Community - is great power)

So final version of the script shoul be looking like this:
===================================================
#!/bin/sh
# Script is dedicated for setting real (external) IP-address in pasv_address=
# parameter in vsftpd.conf.
# It's neccessary for running vsftp in dynamic DNS environment
# behind NAT in passive mode. It checks external IP every 5 minutes, then 
sleeps.
# Wriiten by: ais77 (http://forum.ubuntu.ru)

# Configure these settings:
CONFIG_FILE=/etc/vsftpd.conf # Location of vsftpd.conf
CONFIG_FILE_TMP=/etc/vsftpd.conf.tmp # Location of temporary file
DOMAIN=ais77.homeftp.net # Your external domain (i.e. from DynDNS.com)

touch $CONFIG_FILE_TMP

while :
do
realIP=`dig $DOMAIN +short`
vsftpdIP=`sed -n "/pasv_address=/s/pasv_address=//p" $CONFIG_FILE`
  if [ $realIP != $vsftpdIP ]; then
     sed "s/$vsftpdIP/$realIP/" $CONFIG_FILE > $CONFIG_FILE_TMP
     mv -f $CONFIG_FILE_TMP $CONFIG_FILE
     /etc/init.d/vsftpd restart
  fi
  sleep 5m
done

exit 0
===============================================

-- 
Wrong pasv_address behind the NAT in dynamic IP environment
https://bugs.launchpad.net/bugs/292384
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to