In this tutorial, we’ll learn how to change the default path of the vsftpd FTP server. Our focus is on vsftpd as it’s one of the most common FTP server implementations, but the concepts should apply to others as well.
First, we’ll look at changing the default path for a local user. Then, we’ll explore how to change the default path for an anonymous user.
2. Change Local User Path
To change the default path for a local user, we need to update the vsftpd.conf file. Depending on the Linux distribution, it should be located at either /etc/vsftpd.conf or /etc/vsftpd/vsftpd.conf.
In vsftpd.conf, we simply add the line local_root=<path>, where <path> is the default path of the local user FTP server.
For example, if the new default path is /home/user, we’ll add the following line:
Once the file is updated, we restart vsftpd:
$ sudo service vsftpd restart
After this, we should be able to access the FTP server at the new local path.
3. Change Anonymous User Path
Sometimes, an application needs anonymous login. If that’s the case, we should add the following lines to the vsftpd.conf file:
The first line enables the anonymous login, while the second line updates the default path as in our earlier example.
Again, once updated, we’ll need to restart the FTP server.
In this short article, we looked at two ways of updating the FTP default path. Firstly, we explored the local user vsftpd default path change. Then, we learned how to change the same for the anonymous user.