背景
昨天早上,我正在通过我的 vserver 配置 WordPress 安装SSH
,结果像一个真正的 DAU 一样搞砸了(当然已经登录了root
)。:(
我想将plugins
目录设置为755
,但忘记了.
路径中的。所以我最终执行了chmod -R 755 /*
而不是chmod -R 755 ./*
。
当我意识到我的错误时,在我敲击之前脚本已经运行了 2-3 秒Ctrl+C
。
正如所料,这确实搞乱了我的系统。然而,我已经修复了大部分问题在朋友的帮助下。幸运的是,他在同一个提供商处拥有相同的虚拟服务器。
我从他的安装中“复制”了文件权限find /* -exec stat -c "chmod %a \"%n\"" {} + >~/default_permissions.
,并在我的虚拟服务器上运行了该脚本。
问题
系统的大部分功能似乎又能正常工作了。Plesk、HTTPD、Mail、SSH。但是唯一仍然无法正常运行的是 ProFTPD。usr/local/psa/var/log/ftp_tls.log
我不知道为什么。除了和之外,我找不到任何相关的日志文件/usr/local/psa/var/log/xferlog
。但这些文件不包含任何相关的错误消息。
症状
当我通过普通 FTP 连接时,它会在连接时立即关闭连接,而不要求输入用户名/密码:
root@hostname:/# ftp hostname.tld
Connected to hostname.tld.
421 Service not available, remote server has closed connection
当我通过 sftp 连接时,它仅在我以 身份登录时才有效root
,而不能以普通 ftp 用户身份登录。
root@hostname:/# sftp -v [email protected]
Connecting to hostname.tld...
OpenSSH_5.3p1 Debian-3ubuntu7.1, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to hostname.tld [x.x.x.x] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3p1 Debian-3ubuntu7.1
debug1: match: OpenSSH_5.3p1 Debian-3ubuntu7.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3p1 Debian-3ubuntu7.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'hostname.tld' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
[email protected]'s password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending subsystem: sftp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
Transferred: sent 1424, received 1960 bytes, in 0.0 seconds
Bytes per second: sent 31175.5, received 42910.0
debug1: Exit status 1
Connection closed
root@hostname:/#
我几乎 100% 确定这很可能是由于某些文件仍然具有错误的权限。但我有点迷茫了... 任何帮助都将不胜感激!
编辑
我尝试按照 MariusMatutiae 的建议重新安装 ProFTPD。不幸的是,它没有起作用。
root@hostname:~# sudo apt-get install --reinstall proftpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting proftpd-basic instead of proftpd
The following packages were automatically installed and are no longer required:
libcrypt-rijndael-perl psa11-php-fakepackage libcrypt-cbc-perl
Use 'apt-get autoremove' to remove them.
Suggested packages:
proftpd-doc proftpd-mod-mysql proftpd-mod-pgsql proftpd-mod-ldap proftpd-mod-odbc proftpd-mod-sqlite
The following NEW packages will be installed:
proftpd-basic
0 upgraded, 1 newly installed, 0 to remove and 90 not upgraded.
Need to get 929kB of archives.
After this operation, 2294kB of additional disk space will be used.
Get:1 ftp://ftp.hosteurope.de/mirror/archive.ubuntu.com/ lucid-security/universe proftpd-basic 1.3.2c-1ubuntu0.1 [929kB]
Fetched 929kB in 0s (6206kB/s)
Preconfiguring packages ...
Selecting previously deselected package proftpd-basic.
(Reading database ... 99546 files and directories currently installed.)
Unpacking proftpd-basic (from .../proftpd-basic_1.3.2c-1ubuntu0.1_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/proftpd-basic_1.3.2c-1ubuntu0.1_amd64.deb (--unpack):
trying to overwrite '/etc/pam.d/proftpd', which is also in package psa-proftpd 0:1.3.4c-ubuntu10.04.build115130528.15
dpkg-deb: subprocess paste killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/proftpd-basic_1.3.2c-1ubuntu0.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
然后我尝试重新安装 psa-proftpd,但也没有用。
root@hostname:~# sudo apt-get install --reinstall psa-proftpd
Reading package lists... Done
Building dependency tree
Reading state information... Done
Reinstallation of psa-proftpd is not possible, it cannot be downloaded.
The following packages were automatically installed and are no longer required:
libcrypt-rijndael-perl psa11-php-fakepackage libcrypt-cbc-perl
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 90 not upgraded.
编辑2
问题解决了
/var/log/daemon.log
我发现每次尝试 ftp 连接时,该文件都会添加一个条目:
proftpd[17762]: Fatal: ScoreboardFile: : unable to use '/var/run/proftpd_scoreboard': Operation not permitted on line 72 of '/etc/proftpd.conf'
经过一番 Google 搜索后,我发现了这篇文章:https://forums.proftpd.org/smf/index.php?topic=3516.0
这个人和我遇到了同样的问题。更改权限后,它就停止工作了。
所以我再次比较了两台服务器的权限/var/
和/var/run/
文件夹,并根据另一台服务器的权限进行了更改...现在我又可以连接到 FTP 了!哇!:D