Đầu tiên: cd /root
Sau đó tạo file fix_ftp.sh
vi fix_ftp.sh
Ghi nội dung bên dưới vào file fix_ftp.sh
#!/bin/sh
PF=/etc/proftpd.passwd
cd /usr/local/directadmin/data/users
for u in `ls`; do
{
if [ ! -d $u ]; then
continue;
fi
SHADOW=/home/$u/.shadow
if [ ! -e $SHADOW ]; then
continue;
fi
#make sure it doesn't already exist
COUNT=`grep -c -e "^${u}:" $PF`
if [ "$COUNT" -ne 0 ]; then
continue;
fi
UUID=`id -u $u`
UGID=`id -g $u`
echo "${u}:`cat /home/$u/.shadow`:${UUID}:${UGID}:system:/home/${u}:/bin/false";
};
done;
Lưu lại file sau đó chmod quyền 755 cho file fix_ftp.sh
chmod 755 fix_ftp.sh
Sau đó chạy lệnh
./fix_ftp.sh >> /etc/proftpd.passwd
making sure to use 2 > c-haracters (>>) and not just 1, as using just 1 would de-lete whatever was previously there (which is a bad thing if there are any ftp@domain.com accounts).
Hãy chắc chắn rằng bạn đã sẽ đúng quyền cho file /etc/proftpd.passwd
là root:ftp:
chown root:ftp /etc/proftpd.passwd
chmod 640 /etc/proftpd.passwd