Ubuntu server 12.04/ftp
From Attie's Wiki
(Difference between revisions)
m (→Configure the Server) |
m (→Configure the Server) |
||
Line 14: | Line 14: | ||
export password=xxx | export password=xxx | ||
export database=sys_ftpd | export database=sys_ftpd | ||
+ | |||
+ | echo "no" > /etc/pure-ftpd/auth/70pam | ||
sed -ri /etc/pure-ftpd/db/mysql.conf \ | sed -ri /etc/pure-ftpd/db/mysql.conf \ | ||
Line 20: | Line 22: | ||
-e "s/^(MYSQLDatabase ).*\$/\1$database/" \ | -e "s/^(MYSQLDatabase ).*\$/\1$database/" \ | ||
-e "s/^(MYSQLCrypt ).*\$/\1md5/" | -e "s/^(MYSQLCrypt ).*\$/\1md5/" | ||
+ | |||
+ | echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone | ||
+ | |||
+ | sed -ri /etc/default/pure-ftpd-common \ | ||
+ | -e 's/^(VIRTUALCHROOT=).*$/\1true/' | ||
mysql --user=root -p <<EOF | mysql --user=root -p <<EOF |
Revision as of 16:10, 7 May 2012
apt-get install pure-ftpd-mysql
Control The Server
service pure-ftpd-mysql restart
Configure the Server
export username=ftpd export password=xxx export database=sys_ftpd echo "no" > /etc/pure-ftpd/auth/70pam sed -ri /etc/pure-ftpd/db/mysql.conf \ -e "s/^(MYSQLUser ).*\$/\1$username/" \ -e "s/^(MYSQLPassword ).*\$/\1$password/" \ -e "s/^(MYSQLDatabase ).*\$/\1$database/" \ -e "s/^(MYSQLCrypt ).*\$/\1md5/" echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone sed -ri /etc/default/pure-ftpd-common \ -e 's/^(VIRTUALCHROOT=).*$/\1true/' mysql --user=root -p <<EOF CREATE DATABASE $database; CREATE USER '$username'@'localhost' IDENTIFIED BY '$password'; GRANT ALL PRIVILEGES ON $database.* TO '$username'@'localhost' WITH GRANT OPTION; USE $database; CREATE TABLE \`users\` ( \`id\` int(10) unsigned NOT NULL AUTO_INCREMENT, \`Username\` char(32) NOT NULL, \`Password\` char(32) NOT NULL, \`Dir\` char(128) NOT NULL, \`Uid\` char(16) NOT NULL, \`Gid\` char(16) NOT NULL, PRIMARY KEY (\`id\`) ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; EOF