编辑:pbm毕竟不是我在密码中使用了空格,所以我更改了描述
在尝试配置 xampp 时,我遇到了错误:
fatal: unknown configuration directive 'function' on line 44 of '/opt/lampp/etc/proftpd.conf'
sudo lampp restart
并且它起作用了sudo lampp security
,并且创建了一些密码sudo lampp restart
,但这一次我收到了错误消息/opt/lampp/etc/proftpd.conf
中的文件:
40 # daemon gets the password "xampp"
41 # commented out by xampp security
42 #UserPassword daemon 2TgxE8g184G9c
43 UserPassword daemon <?
44 function make_seed() {
45 list($usec, $sec) = explode(' ', microtime());
46 return (float) $sec + ((float) $usec * 100000);
47 }
48 srand(make_seed());
49 $random=rand();
50 $chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
51 $salt=substr($chars,$random % 64,1).substr($chars,($random/64)%64,1);
52 $pass=$argv[1];
53 $crypted = crypt($pass,$salt);
54 echo $crypted."
55 ";
56 ?>
如果我评论所有这些行,xampp 就会启动,我可以转到网页 localhost/phpmyadmin/,在那里我想更改我的密码为一个不带单引号的新密码,但它说我不允许:
MySQL said: Documentation
#1131 - You are using MariaDB as an anonymous user and anonymous users are not allowed to modify user settings
另外,我的密码在这个文件 /opt/lampp/phpmyadmin 中是清楚的:
38 /**
39 * phpMyAdmin configuration storage settings.
40 */
41
42 /* User used to manipulate with storage */
43 // $cfg['Servers'][$i]['controlhost'] = '';
44 // $cfg['Servers'][$i]['controlport'] = '';
45 $cfg['Servers'][$i]['controluser'] = 'pma';
46 # commented out by xampp security
47 #$cfg['Servers'][$i]['controlpass'] = '';
48 $cfg['Servers'][$i]['controlpass'] = 'password_here';
我不知道如何解决。
我尝试卸载所有内容并重新开始,但它没有解决问题(我这样做了,所以我确信我做了什么)。
你实际上做了什么
sudo lampp security
它只是生成了下面这个关于哈希和盐的小样板,传入了$LAMP_DIR/etc/proftpd.conf
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
srand(make_seed());
$random=rand();
$chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
$salt=substr($chars,$random % 64,1).substr($chars,($random/64)%64,1);
$pass=$argv[1];
$crypted = crypt($pass,$salt);
echo $crypted."
";
没关系。只是因为您的 xampp php 没有自动编译哈希,您可以通过在
php
之后添加 UserPassword $ftpuser <?
关键字来进行下一步,如下所示:
UserPassword daemon <?php
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
#bla-bla-bla
不要忘记在
$pass=$argv[1];
只需更改 $pass="your password here";
然后用你的 php 解释器运行它们
/opt/lampp/bin/php /opt/lampp/etc/proftpd.conf
和中提琴
# daemon gets the password "xampp"
# commented out by xampp security
#UserPassword daemon 2TgxE8g184G9c
UserPassword daemon dAN1WkV7r2TsU
# daemon is no normal user so we have to allow users with no real shell
RequireValidShell off
# daemon may be in /etc/ftpusers so we also have to ignore this file
UseFtpUsers off
dev@enigma:/opt/lampp$
您已获得新密码
UserPassword $ftpuser dAN1WkV7r2TsU
或者您可以使用
UserPassword $ftpuser "plain_pw_here"
指定纯密码
我使用以下代码更改了“proftpd.conf”文件:
UserPassword daemon lampp
#UserPassword daemon <?
# function make_seed() {
# list($usec, $sec) = explode(' ', microtime());
# return (float) $sec + ((float) $usec * 100000);
# }
# srand(make_seed());
# $random=rand();
# $chars="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
# $salt=substr($chars,$random % 64,1).substr($chars,($random/64)%64,1);
# $pass=$argv[1];
# $crypted = crypt($pass,$salt);
# echo $crypted."
#";
#?>
对于这个方法有疑问的人,我前段时间在网上找到了它,不记得出处了,(顺便说一下,该解决方案是针对Linux的,但可能有一个针对Windows的等效方案,windows用户应该谷歌一下)。
1 - 安装 apache2-utils:
sudo apt install apache2-utils
2 - 生成凭据
htpasswd -nd myuser
3 - 它将要求输入密码并对其进行加密,出现结果并以以下格式显示在屏幕上: 用户:加密密码
4 - 复制加密密码并打开文件: $LAMP_DIR/etc/proftpd.conf
5 - 找到有问题的行:
UserPassword daemon <?
function make_seed() { etc...
并将其替换为(htpasswd命令生成的用户名和加密密码):
UserPassword myuser encryptedpassword
希望它对你和我都有帮助。