ProFTPD not working properly anymore after chmod accident

2

Background

Yesterday morning I was configuring a WordPress installation on my vserver via SSH and screwed up like a proper DAU (been logged in as root of course). :(

I wanted to set the plugins directory to 755 and forgot the . in the path. So I ended up executing chmod -R 755 /* instead of chmod -R 755 ./*.

When I realized my mistake the script already ran for like 2-3 seconds, before I hammered Ctrl+C.

As to be expected, this really messed up my system. However, I got most of it fixed with a friends help. He fortunately has the same vserver at the same provider.

I "copied" the file permissions from his installation using find /* -exec stat -c "chmod %a \"%n\"" {} + >~/default_permissions. and ran the script on my vserver.

Problem

Most of the system seems to work again. Plesk, HTTPD, Mail, SSH. But the only thing still not working properly is ProFTPD. And I can't figure out why. I can't find any relevant log files, besides usr/local/psa/var/log/ftp_tls.log and /usr/local/psa/var/log/xferlog. But these don't contain any related error messages.

Symptoms

When I connect via normal FTP, it closes the connection instantly on connect, without asking for username / password:

root@hostname:/# ftp hostname.tld
Connected to hostname.tld.
421 Service not available, remote server has closed connection

When I connect via sftp, it only works when I login as root, but not as normal ftp user.

root@hostname:/# sftp -v user@hostname.tld
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
user@hostname.tld's password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
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 eow@openssh.com 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:/#

I'm almost 100% sure that this is most likely due to some files still having the wrong permissions. But I'm a bit lost here ... Any help would be highly appreciated!

Edit

I tried reinstalling ProFTPD as suggest by MariusMatutiae. Unfortunately it didn't work.

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)

I then tried reinstalling psa-proftpd, but it didn't work either.

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.

Edit 2

Problem solved

I discovered that the /var/log/daemon.log file got an entry added everytime I tried a ftp connection:

proftpd[17762]: Fatal: ScoreboardFile: : unable to use '/var/run/proftpd_scoreboard': Operation not permitted on line 72 of '/etc/proftpd.conf'

After a bit of Google'ing I found this post: https://forums.proftpd.org/smf/index.php?topic=3516.0

This guy had the same problems like me. After changing permissions it stopped working for him.

So I again compared the permissions of the /var/ and /var/run/ folders of both servers and changed it on mine according to the other server ... And now I'm able to connect to FTP again! WHEE! :D

Mario Werner

Posted 2015-12-20T10:06:46.167

Reputation: 129

2Why don't you simply apt-get install --reinstall your proftpd package? You can set aside configuration files quite easily, then reinstalling is much simpler than searching for a needle in a haystack. – MariusMatutiae – 2015-12-20T10:19:32.590

@MariusMatutiae Yes, you are right. But I'm unsure if this doesn't mess up anything related with Plesk. – Mario Werner – 2015-12-20T10:45:05.890

@MariusMatutiae Got it solved. – Mario Werner – 2015-12-20T11:50:45.383

No answers