ftp和mysql数据库结合使用
问题描述:
看下 1.1.1.1 的ftp为什么连不上 报错的信息:
'ftpServer' => '1.1.1.1', // FTP服务器地址
'ftpPort' => '',
'ftpUsername' => 'admin.was.chinasoft.com', // FTP账号
'ftpPassword' => 'ftp_pass',
报错信息:
FTP connection has failed!Attempted to connect to 1.1.1.1 for user admin.was.chinasoft.com 处理过程:
首先登录 1.1..1_server01_was_web01 这台网宿的服务器 .查看进程是否正常
[root@server01:/usr/local/proftpd-1.3.6rc2]# ps -ef|grep ftp
apache : ? :: proftpd: (accepting connections)
apache : ? :: proftpd: admin.was.chinasoft.com - 3.3.3.3: IDLE .连接21端口,看服务是否能够正常通讯
C:\Users\ws>telnet 2.2.2.2 .找到/usr/local/proftpd-1.3.6rc2/的程序运行目录 [root@server01:/usr/local/proftpd-1.3.6rc2]# cd /usr/local/proftpd-1.3.6rc2/
[root@server01:/usr/local/proftpd-1.3.6rc2]# ll
total
-rwxr-xr-x root root Apr adduser_domain.sh
-rwx------ root root Apr adduser.sh
drwxr-xr-x root root Apr bin
drwxr-xr-x root root Jul : etc
drwxr-xr-x root root Apr include
drwxr-xr-x root root Apr lib
drwxr-xr-x root root Apr libexec
-rwxr-xr-x root root Mar proftpd.sh
drwxr-xr-x root root Apr sbin
drwxr-xr-x root root Apr share
drwxr-xr-x root root Jul : var # 添加用户的脚本(作废)
[root@server01:/usr/local/proftpd-1.3.6rc2]# cat adduser.sh
#!/bin/bash
usage () {
echo ""
echo " Please Input Correct infomation!"
echo ""
echo " USAGE: `basename $0` username /dir ftp_server_ip"
echo " Exp: `basename $0` Lee /data/lee/home 1.1.1.1,2.2.2.2"
echo ""
echo " Result:"
echo " UserName: Lee"
echo " UserHome: /data/lee/home"
echo " PassWord: N1Jy3Fqol"
echo ""
} if [[ $ == "" ]];then
usage;
exit ;
fi datetime=`date +%Y%m%d" "%H:%M:%S`
userid=$
passwd=`mkpasswd -l -d -c -C -s `
home=$
dst_passwd='{md5}'`/bin/echo -n "$passwd" | openssl dgst -binary -md5 | openssl enc -base64`
shell='/sbin/nologin'
accesshost=$
/usr/local/mysql/bin/mysql -u ftp_user -p'pass' -h 192.168.1.189 -e "\
use ftp_db;insert into FTPUSERS VALUES('$userid','$dst_passwd',,,'$home','/sbin/nologin','$accesshost','$datetime');"
echo "UserName: $userid"
echo "PassWord: $passwd"
echo "userHome: $home"
echo "FTP IPs: $accesshost"
echo "" # 添加用户和域名对应关系的脚本
[root@server01:/usr/local/proftpd-1.3.6rc2]# cat adduser_domain.sh
#!/bin/bash usage () {
echo ""
echo " Please Input Correct infomation!"
echo ""
echo " USAGE: `basename $0` domainname ftp_server_ip"
echo " Exp: `basename $0` www.test.com Server1,Server2"
echo ""
echo " Result:"
echo " UserName: www.test.com"
echo " PassWord: N1Jy3Fqol"
echo ""
} if [[ $ == "" ]];then
usage;
exit ;
fi datetime=`date +%Y%m%d" "%H:%M:%S`
userid=$
passwd=`mkpasswd -l -d -c -C -s `
domain=$userid
if [[ $ =~ ^www ]];then
domain=${#www.}
fi
dst_passwd='{md5}'`/bin/echo -n "$passwd" | openssl dgst -binary -md5 | openssl enc -base64`
home="/data/www/vhosts/$domain"
shell='/sbin/nologin'
accesshost=$
/usr/local/mysql/bin/mysql -u ftp_user -p'pass' -h 192.168.1.189 -e "\
use ftp_db;insert into FTPUSERS VALUES('$userid','$dst_passwd',,,'$home','/sbin/nologin','$accesshost','$datetime');"
echo "UserName: $userid"
echo "PassWord: $passwd"
echo "FTP IPs: $accesshost"
echo "" ***192.168..189这个mysql不存在 ③继续查看配置文件 [root@server01:/usr/local/proftpd-1.3.6rc2/etc]# cat /usr/local/proftpd-1.3.6rc2/etc/proftpd.conf
# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use. It establishes a single server
# and a single anonymous login. It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon. ServerName "ProFTPD Default Installation"
ServerType standalone
DefaultServer on # Port is the standard FTP port.
Port # Don't use IPv6 support by default.
UseIPv6 off # Umask is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask
TimeoutLogin
TimeoutIdle
TimeoutNoTransfer
TimeoutStalled
# Where do we put the pid files?
#ScoreboardPath /var/run/proftpd
# To prevent DoS attacks, set the maximum number of child processes
# to . If you need to allow more than concurrent connections
# at once, simply increase this value. Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances
MaxLoginAttempts
# Set the user and group under which the server will run.
User apache
Group users # To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
#DefaultRoot ~ # Normally, we want files to be overwriteable.
AllowOverwrite on
# 上传断点续传
AllowRetrieveRestart on
AllowStoreRestart on
# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
DenyAll
</Limit> # A basic anonymous configuration, no upload directories. If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
#<Anonymous ~ftp>
# User ftp
# Group ftp # We want clients to be able to login with "anonymous" as well as "ftp"
# UserAlias anonymous ftp # Limit the maximum number of anonymous logins
# MaxClients # We want 'welcome.msg' displayed at login, and '.message' displayed
# in each newly chdired directory.
# DisplayLogin welcome.msg
# DisplayChdir .message # Limit WRITE everywhere in the anonymous chroot
# <Limit WRITE>
# DenyAll
# </Limit>
#</Anonymous>
#设置MySQL认证:
#数据库联接的信息,DatabaseName是数据库名, HostName是主机名,
#Port是端口号,UserName是连接数据库的用户名,Password是密码。
SQLConnectInfo ftp_db@192.168.1.148 ftp_user pass #数据库认证的类型:
SQLAuthTypes OpenSSL #指定用来做用户认证的表的有关信息。("FTPUSERS"和"FTPGRPS"是数据表名字,等一会而在下面建立)
SQLUserInfo FTPUSERS userid passwd uid gid home shell
SQLGroupInfo FTPGRPS grpname gid members #设置如果shell为空时允许用户登录:
RequireValidShell off #数据库的鉴别
SQLAuthenticate users groups usersetfast groupsetfast #如果home目录不存在,则系统会为根据它的home项新建一个目录:
CreateHome off #判断这个用户是否允许登录本机
#SQLUserWhereClause "accesshost like'%10.10.26.195%'" #这里的%号ProFtp不识别, 妈的!所以用下面的方法.
SQLUserWhereClause "0 !=FIND_IN_SET('2.2.2.2',accesshost)" #SQL验证日志
#SQLLog
SQLLogFile /usr/local/proftpd/var/sql.log #SQL验证用户的UID和GID
SQLMinUserUID
SQLMinUserGID
SQLDefaultUID
SQLDefaultGID ##### #####
MaxClients
UseReverseDNS off
IdentLookups off
#QuotaLimitTable file:/usr/local/proftpd1./etc/ftpquota.limittab
#QuotaTallyTable file:/usr/local/proftpd1./etc/ftpquota.tallytab
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaEngine on
QuotaLog /usr/local/proftpd/var/quota.log
QuotaShowQuotas on
QuotaOptions ScanOnLogin
DefaultRoot ~
DisplayLogin welcome.msg
AllowStoreRestart on ############ Fixed Log Format #########
LogFormat awstats "%t %h %u %m %f %s %b"
ExtendedLog /usr/local/proftpd/var/transfer.log read,write awstats
TransferLog /usr/local/proftpd/var/transfer.log
ServerLog /usr/local/proftpd/var/server.log
#Single system with both ProFTPd and Clamd utilizing TCP sockets. Additionally, only files who's size is less than 250MB will be scanned. ④找到关键信息
SQLConnectInfo ftp_db@192.168.1.148 ftp_user pass 连接数据库,查看表FTPUSERS查看表,猜想这个表就是用户名密码和权限的控制表 [root@server01:/usr/local/proftpd-1.3.6rc2]# mysql -h192.168.1. -uftp_user -p'pass'
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7.--log Source distribution Copyright (c) - Percona LLC and/or its affiliates
Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| ftp_db |
+--------------------+
rows in set (0.00 sec) mysql> use ftp_db;
Database changed
mysql> show tables;
+------------------+
| Tables_in_ftp_db |
+------------------+
| FTPGRPS |
| FTPUSERS |
| quotalimits |
| quotatallies |
+------------------+
rows in set (0.00 sec) mysql> select * from FTPUSERS;
+---------------------------------------+-------------------------------+-----+-----+-----------------------------------------------------------------------------------------------------------------------------------+---------------+--------------------------+-------------------+
| userid | passwd | uid | gid | home | shell | accesshost | coment |
+---------------------------------------+-------------------------------+-----+-----+-----------------------------------------------------------------------------------------------------------------------------------+---------------+--------------------------+-------------------+
| pay_com | {md5}MCbog7BadfaroQ== | | | /data/www/vhosts/platform.chinasoft.com | /sbin/nologin | web3 | | 通过本地登录ftp报错:
root@server01:/usr/local/proftpd-1.3.6rc2]# tail -f /usr/local/proftpd/var/server.log -- ::, server01 proftpd[] 2.2.2.2 (3.3.3.3[3.3.3.3]): USER admin.was.chinasoft.com: no such user found from 3.3.3.3 [3.3.3.3] to 1.1.1.1: 结合客户端报错:
FTP connection has failed!Attempted to connect to 1.1.1.1 for user admin.was.chinasoft.com 数据库中有 1.1.1.1 这个授权
INSERT INTO ``(`userid`, `passwd`, `uid`, `gid`, `home`, `shell`, `accesshost`, `coment`) VALUES ('admin.was.chinasoft.com', '{md5}eddddd==', , , '/data/www/vhosts/admin.was.chinasoft.com', '/sbin/nologin', 'web3', '20150306 17:30:57');
INSERT INTO ``(`userid`, `passwd`, `uid`, `gid`, `home`, `shell`, `accesshost`, `coment`) VALUES ('admin.was.chinasoft.com', '{md5}bOBvuP1/afda==', , , '/data/www/vhosts/admin.was.chinasoft.com', '/sbin/nologin', '1.1.1.1', '20150818 23:29:30'); 报错提到了2.2.2.2刚好是这个服务器的两个IP,于是添加2.2.2.2授权
INSERT INTO ``(`userid`, `passwd`, `uid`, `gid`, `home`, `shell`, `accesshost`, `coment`) VALUES ('admin.was.chinasoft.com', '{md5}bOBvuP1/afdfdadfa==', , , '/data/www/vhosts/admin.was.chinasoft.com', '/sbin/nologin', '2.2.2.2', '20180706 10:58:00'); 重新登录发现可以正常获取ftp家目录,至此问题解决
cc-download.chinasoft.cc的处理 # 添加用户的时候报错 [root@sz_chinasoft:/usr/local/proftpd]# ./adduser.sh cc-download.chinasoft.cc /data/www/vhosts/cc-download.chinasoft.cc 1.1.1.1
./adduser.sh: line : mkpasswd: command not found
mysql: [Warning] Using a password on the command line interface can be insecure.
UserName: cc-download.chinasoft.cc
PassWord:
userHome: /data/www/vhosts/cc-download.chinasoft.cc
FTP IPs: 1.1.1.1 # 解决
# yum install -y expect [root@sz_chinasoft:/usr/local/proftpd]# ./adduser.sh cc-download.chinasoft.cc /data/www/vhosts/cc-download.chinasoft.cc 2.2.2.2
mysql: [Warning] Using a password on the command line interface can be insecure.
UserName: cc-download.chinasoft.cc
PassWord: 5sjVCiP3y
userHome: /data/www/vhosts/cc-download.chinasoft.cc
FTP IPs: 2.2.2.2 select * from FTPUSERS where userid like 'cc-download.chinasoft.cc' limit INSERT INTO `FTPUSERS`(`userid`, `passwd`, `uid`, `gid`, `home`, `shell`, `accesshost`, `coment`) VALUES ('cc-download.chinasoft.cc', '{md5}YO/rrFcFuus/1wWWpl2DcQ==', , , '/data/www/vhosts/cc-download.chinasoft.cc', '/sbin/nologin', 'sz_chinasoft', '20190515 20:06:42'); SELECT userid, passwd, uid, gid, home, shell FROM FTPUSERS WHERE (userid='cc-download.chinasoft.cc') AND ((( !=FIND_IN_SET('sz_chinasoft',accesshost)))) LIMIT # 观察日志 [root@sz_chinasoft:/usr/local/proftpd/var]# tail -f sql.log
-- ::, mod_sql/4.3[]: >>> cmd_endpwent
-- ::, mod_sql/4.3[]: <<< cmd_endpwent
。。。 -- ::, mod_sql/4.3[]: query "SELECT userid, passwd, uid, gid, home, shell FROM FTPUSERS WHERE (userid='cc-download.chinasoft.cc') AND (((0 !=FIND_IN_SET('sz_chinasoft',accesshost)))) LIMIT 1"
。。。。
-- ::, mod_sql/4.3[]: connection 'default' count is now
-- ::, mod_sql/4.3[]: exiting mysql cmd_open
-- ::, mod_sql/4.3[]: query "SELECT grpname FROM FTPGRPS WHERE (gid = 100) LIMIT 1"
-- ::, mod_sql/4.3[]: entering mysql cmd_close
-- ::, mod_sql/4.3[]: connection 'default' count is now
-- ::, mod_sql/4.3[]: exiting mysql cmd_close
-- ::, mod_sql/4.3[]: exiting mysql cmd_select # 拿这句去数据库里面查询是查不到信息的 SELECT userid, passwd, uid, gid, home, shell FROM FTPUSERS WHERE (userid='cc-download.chinasoft.cc') AND ((( !=FIND_IN_SET('sz_chinasoft',accesshost)))) LIMIT AND ((( !=FIND_IN_SET('sz_chinasoft',accesshost)))) LIMIT 1这句来自配置文件 [root@sz_chinasoft:/usr/local/proftpd/var]# more ../etc/proftpd.conf #判断这个用户是否允许登录本机
#SQLUserWhereClause "accesshost like'%10.10.26.195%'" #这里的%号ProFtp不识别, 所以用下面的方法.
SQLUserWhereClause "0 !=FIND_IN_SET('sz_chinasoft',accesshost)" # 插入本机到数据库问题解决
INSERT INTO `FTPUSERS`(`userid`, `passwd`, `uid`, `gid`, `home`, `shell`, `accesshost`, `coment`) VALUES ('cc-download.chinasoft.cc', '{md5}YO/rrFcFuus/1wWWpl2DcQ==', , , '/data/www/vhosts/cc-download.chinasoft.cc', '/sbin/nologin', 'sz_chinasoft', '20190515 20:06:42'); SELECT userid, passwd, uid, gid, home, shell FROM FTPUSERS WHERE (userid='cc-download.chinasoft.cc') AND ((( !=FIND_IN_SET('sz_chinasoft',accesshost)))) LIMIT
1.添加用户步骤
a.执行下面的脚本,注意修改脚本中连接数据库的ip和用户名密码
[root@web:/usr/local/proftpd]# ./adduser.sh cc-dlinst.chinasoft.cc /data/www/vhosts/dlinst.chinasoft.com 120.1.1.1
mysql: [Warning] Using a password on the command line interface can be insecure.
UserName: cc-dlinst.chinasoft.cc
PassWord: pass
userHome: /data/www/vhosts/dlinst.chinasoft.com
FTP IPs: 120.1.1.1
2.还需要插入如下4条字段,注意是 登录ftp服务器的内网、外网ip、还有ftp服务器的主机名 和 客户端的 外网ip
INSERT INTO ftpusers (`userid`, `passwd`, `uid`, `gid`, `home`, `shell`, `accesshost`, `coment`) VALUES ('cc-dlinst.chinasoft.cc', '{md5}/A==', 500, 100, '/data/www/vhosts/dlinst.chinasoft.com', '/sbin/nologin', '120.1.1.1', '20190711 01:37:01');
INSERT INTO ftpusers (`userid`, `passwd`, `uid`, `gid`, `home`, `shell`, `accesshost`, `coment`) VALUES ('cc-dlinst.chinasoft.cc', '{md5}/A==', 500, 100, '/data/www/vhosts/dlinst.chinasoft.com', '/sbin/nologin', 'sz_cc_cbs_download01', '20190515 20:06:42');
INSERT INTO ftpusers (`userid`, `passwd`, `uid`, `gid`, `home`, `shell`, `accesshost`, `coment`) VALUES ('cc-dlinst.chinasoft.cc', '{md5}/A==', 500, 100, '/data/www/vhosts/dlinst.chinasoft.com', '/sbin/nologin', '192.168.1.108', '20190711 01:37:01');
INSERT INTO ftpusers (`userid`, `passwd`, `uid`, `gid`, `home`, `shell`, `accesshost`, `coment`) VALUES ('cc-dlinst.chinasoft.cc', '{md5}/A==', 500, 100, '/data/www/vhosts/cc-dlinst.chinasoft.com', '/sbin/nologin', '150.1.1.1', '20190708 14:37:00');
.ftp认证数据库信息 # 连接数据库的账号密码信息
grant select,insert,update,delete on ftp_db.* to ftp_user@"%" identified by "pass"; # 创建ftp认证表 CREATE TABLE `ftpgrps` (
`grpname` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`gid` smallint() NOT NULL,
`members` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; CREATE TABLE `ftpusers` (
`userid` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`passwd` text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`uid` int() NOT NULL,
`gid` int() NOT NULL,
`home` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
`shell` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
`accesshost` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL,
`coment` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; CREATE TABLE `quotalimits` (
`name` varchar() CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
`quota_type` enum('user','group','class','all') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'user',
`per_session` enum('false','true') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'false',
`limit_type` enum('soft','hard') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'soft',
`bytes_in_avail` float NOT NULL DEFAULT ,
`bytes_out_avail` float NOT NULL DEFAULT ,
`bytes_xfer_avail` float NOT NULL DEFAULT ,
`files_in_avail` int() UNSIGNED NOT NULL DEFAULT ,
`files_out_avail` int() UNSIGNED NOT NULL DEFAULT ,
`files_xfer_avail` int() UNSIGNED NOT NULL DEFAULT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; CREATE TABLE `quotatallies` (
`name` varchar() CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '',
`quota_type` enum('user','group','class','all') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'user',
`bytes_in_used` float NOT NULL DEFAULT ,
`bytes_out_used` float NOT NULL DEFAULT ,
`bytes_xfer_used` float NOT NULL DEFAULT ,
`files_in_used` int() UNSIGNED NOT NULL DEFAULT ,
`files_out_used` int() UNSIGNED NOT NULL DEFAULT ,
`files_xfer_used` int() UNSIGNED NOT NULL DEFAULT
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic; # 添加ftp用户的脚本 /usr/local/proftpd/adduser.sh
#!/bin/bash usage () {
echo ""
echo " Please Input Correct infomation!"
echo ""
echo " USAGE: `basename $0` username /dir ftp_server_ip"
echo " Exp: `basename $0` Lee /data/lee/home 1.1.1.1,2.2.2.2"
echo ""
echo " Result:"
echo " UserName: Lee"
echo " UserHome: /data/lee/home"
echo " PassWord: N1Jy3Fqol"
echo ""
} if [[ $ == "" ]];then
usage;
exit ;
fi datetime=`date +%Y%m%d" "%H:%M:%S`
userid=$
passwd=`mkpasswd -l -d -c -C -s `
home=$
dst_passwd='{md5}'`/bin/echo -n "$passwd" | openssl dgst -binary -md5 | openssl enc -base64`
shell='/sbin/nologin'
accesshost=$
# 连接ftp_db的账号密码
/usr/local/mysql/bin/mysql -u cn_chinasoft_ftp_user -p'pass' -h ftp数据库的ip地址 -e "\
use ftp_db;insert into FTPUSERS VALUES('$userid','$dst_passwd',,,'$home','/sbin/nologin','$accesshost','$datetime');"
echo "UserName: $userid"
echo "PassWord: $passwd"
echo "userHome: $home"
echo "FTP IPs: $accesshost"
echo "" .ftp配置 # egrep -v '^#|^$' /usr/local/proftpd/etc/proftpd.conf
ServerName "ProFTPD Default Installation"
ServerType standalone
DefaultServer on
Port
UseIPv6 off
Umask
TimeoutLogin
TimeoutIdle
TimeoutNoTransfer
TimeoutStalled
MaxInstances
MaxLoginAttempts
User apache
Group users
AllowOverwrite on
AllowRetrieveRestart on
AllowStoreRestart on
<Limit SITE_CHMOD>
DenyAll
</Limit>
# 连接ftp认证数据库的信息
SQLConnectInfo ftp_db@xx ftp_user pass SQLAuthTypes OpenSSL
SQLUserInfo FTPUSERS userid passwd uid gid home shell
SQLGroupInfo FTPGRPS grpname gid members
RequireValidShell off
SQLAuthenticate users groups usersetfast groupsetfast
CreateHome off
# ftp服务器外网ip地址(即安装ftp服务端的ip地址)
SQLUserWhereClause "0 !=FIND_IN_SET('ftp_server_ip',accesshost)"
SQLLogFile /usr/local/proftpd/var/sql.log
SQLMinUserUID
SQLMinUserGID
SQLDefaultUID
SQLDefaultGID
MaxClients
UseReverseDNS off
IdentLookups off
QuotaDirectoryTally on
QuotaDisplayUnits Mb
QuotaEngine on
QuotaLog /usr/local/proftpd/var/quota.log
QuotaShowQuotas on
QuotaOptions ScanOnLogin
DefaultRoot ~
DisplayLogin welcome.msg
AllowStoreRestart on
LogFormat awstats "%t %h %u %m %f %s %b"
ExtendedLog /usr/local/proftpd/var/transfer.log read,write awstats
TransferLog /usr/local/proftpd/var/transfer.log
ServerLog /usr/local/proftpd/var/server.log .添加用户
# 命令格式:./adduser.sh 账号 根目录 ftp客户端ip地址
[/usr/local/proftpd]# ./adduser.sh download.chinasoft.cn /data/www/vhosts/download.chinasoft.cn 1.1.1.1
mysql: [Warning] Using a password on the command line interface can be insecure.
UserName: download.chinasoft.cn
PassWord: pass
userHome: /data/www/vhosts/download.chinasoft.cn
FTP IPs: 1.1.1.1 INSERT INTO `ftp_db`.`ftpusers`(`userid`, `passwd`, `uid`, `gid`, `home`, `shell`, `accesshost`, `coment`) VALUES ('download.chinasoft.cn', '{md5}da/6deocTTdo==', , , '/data/www/vhosts/download.chinasoft.cn', '/sbin/nologin', '1.1.1.1', '20200421 13:53:15');
ftp和mysql数据库结合使用的更多相关文章
- ftp获取mysql数据库方法
我说的这种情况是针对mysql数据库的,首先下载一个mysql通过ftp放到站点里面,然后通过配置文件找到数据库的名字和密码,然后通过浏览器访问数据库,直接在域名后面加上下载的mysql文件的名字就可 ...
- Linux下自动备份MySQL数据库并上传到远程FTP服务器
Linux下自动备份MySQL数据库并上传到远程FTP服务器且删除指定日期前的备份Shell脚本 说明: 1.备份MySQL数据库存放目录/var/lib/mysql下面的xshelldata数据库 ...
- Linux VPS自动定时备份网站文件和MYSQL数据库到FTP空间(LNMP)
如果我们网站更新不是很频繁,我们可以定期手动进行备份网站文件和MYSQL数据库导出.如果我们网站数据更新频繁,且数据尤为重要,建议要采用定期自动 备份,至少需要多备份数据,无论我们选择何种优秀的VPS ...
- python + docker, 实现天气数据 从FTP获取以及持久化(二)-- python操作MySQL数据库
前言 在这一节中,我们主要介绍如何使用python操作MySQL数据库. 准备 MySQL数据库使用的是上一节中的docker容器 “test-mysql”. Python 操作 MySQL 我们使用 ...
- CentOS Linux自动备份MySQL数据库到远程FTP服务器并删除指定日期前的备份Shell脚本
说明: 我这里要把MySQL数据库存放目录/var/lib/mysql下面的pw85数据库备份到/home/mysql_data里面,并且保存为mysqldata_bak_2011_11_03.tar ...
- 二进制包安装MySQL数据库
1.1二进制包安装MySQL数据库 1.1.1 安装前准备(规范) [root@Mysql_server ~]# mkdir -p /home/zhurui/tools ##创建指定工具包存放路径 [ ...
- 腾讯云服务器centos 6.5(jdk+tomcat+vsftp)、腾讯mysql数据库 及 tomcat自启动 配置教程
1.腾讯云数据库配置 1.考虑到安全性问题,,平常不使用root用户登录,新增一个用户名neil,用来管理项目的数据库 a.首先登录root创建db_AA数据库 b.在root用户下,创建neil用户 ...
- 使用xtrabackup备份mysql数据库
数据在一个企业里非常重要,因此经常需要备份数据库,确保出线故障时,可以立刻恢复数据到最新状态,目前常见的备份工具有mysqldump和xtrabackup,数据量较少时可以使用mysqldump,但随 ...
- Centos下mysql数据库备份与恢复的方法
一.mysqldump工具备份 mysqldump由于是mysql自带的备份工具,所以也是最常用的mysql数据库的备份工具.支持基于InnoDB的热备份.但由于是逻辑备份,所以速度不是很快,适合备份 ...
随机推荐
- Jdbc、Mybatis、Hibernate各自优缺点及区别
文章出处:Jdbc,Mybatis,Hibernate各自优缺点及区别 先比较下jdbc编程和hibernate编程各自的优缺点. 1.JDBC 我们平时使用jdbc进行编程,大致需要下面几个步骤: ...
- 原生sql整理
mysql -uroot -p #登录mysql命令password: #输入密码 mysql> #每条mysql命令后面都要加分号结尾show databases; #打印整个mysql数据库 ...
- 龙光集团地产跃居“中国房地产500强TOP28”
3月20日,由中国房地产业协会.上海易居房地产研究院中国房地产测评中心联合主办的2019中国房地产500强测评成果发布会在北京成功举办.本次测评成果显示,龙光集团地产凭借综合实力,不仅成功跻身“中国房 ...
- P1177 【模板】快速排序(学完归并和堆排之后的二更)
P1177 [模板]快速排序 不用说,连题目上都标了是一道模板,那今天就来对能用到的许多排序方式进行一个总结: 选择排序 选择排序(Selection sort)是一种简单直观的排序算法.它的工作原理 ...
- (十一)QPainter绘图, QPixmap,QImage,QPicture,QBitmap
#include "widget.h" #include "ui_widget.h" #include <QPainter> #include &l ...
- python自动启动appium服务
我们可以通过socket模块来检查appium是否启动,如果未启动,可以通过subprocess模块来启动,需要导入socket和subprocess模块,具体如下图: 第1个函数:表示检查appiu ...
- Matlab安装完成后,出现错误licensing error:-8523的解决方法
Matlab2018安装成功后,打开出现licensing error:-8523解决方法 https://blog.csdn.net/qq_41634276/article/details/8000 ...
- 【莫烦Pytorch】【P1】人工神经网络VS. 生物神经网络
滴:转载引用请注明哦[握爪] https://www.cnblogs.com/zyrb/p/9700343.html 莫烦教程是一个免费的机器学习(不限于)的学习教程,幽默风俗的语言让我们这些刚刚起步 ...
- redis5.0.3单实例简单安装记录
redis5.0.3单实例简单安装记录 日常需要测试使用,索性记录下来,免得临时又麻烦的找资料. yum -y install make gcc-c++ cmake bison-devel ncurs ...
- com.alibaba.druid数据源工具类
Druid是阿里巴巴推出的国产数据库连接池,据网上测试对比,比目前的DBCP或C3P0数据库连接池性能更好.它不仅仅是一个数据库连接池,它还包含一个ProxyDriver,一系列内置的JDBC组件库, ...