Ubuntu server 12.04/ftp

From Attie's Wiki
Jump to: navigation, search

Ubuntu Server 12.04

This package doesn't behave, instead I have provided users with SFTP/SSH access

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
 
echo "yes" > /etc/pure-ftpd/conf/ChrootEveryone
echo "yes" > /etc/pure-ftpd/conf/DontResolve
 
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/"
 
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
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox