0

Google VM, centos 7, vsftpd server. I have ftpuser, homedir /var/www/html

cat /etc/passwd | grep ftpuser 
ftpuser:x:1001:48::/var/www/html:/bin/bash

from root user I have moved folder /var/www/html to /home/users/user1 (and created new /var/www/html from my backup). Now ftpuser uploading files via vsftpd server into /home/users/user1 folder. After linux reboot the ftpuser working directory again /var/www/html as expected. I've reproduced the situation twice. What is happening ? How can it be possible ?

2
  • 1
    It sounds to me like vsftpd cached the home directory for that user. Your instance of vsftpd thought it knew where the FTP user's home directory was when it started; it opened that directory and held it open; then you moved it. After the move, short of a reboot, you may have been aple to simply restart vsftpd to have it re-read/re-open the new directory. I don't know if a "reload" would do the same.
    – Jeff Schaller
    Commented Sep 4, 2018 at 17:03
  • Yes, looks like cached file handler. vsftpd restart returned home to /var/www/html Surprise ...
    – Triffids
    Commented Sep 5, 2018 at 7:23

1 Answer 1

1

Welcome to unix.SE.

The application (vsftp) has already opened the directory. To the application, the opened directory is represented by a file descriptor (or "handle"). The directory may be renamed (or moved on the file-system), but this will not invalidate the descriptor. In case of vsftp, the directory is probably also the working directory, which vsftp never changes (the descriptor never needs updating).

1
  • Yes, looks like a handler "feature". I had a feeling that it can be related to file handler cache, but expected that linux kernel will prevent ftpuser write to /home/users/user1 after move. Thank you for the clarification.
    – Triffids
    Commented Sep 5, 2018 at 7:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .