Storing FTP details in wp-config.php

I would consider it somewhat safe since that’s where your database connection information is also stored. One could easily ruin your website by deleting your whole database if they had access to that file.

There are a couple of things you can do to increase security:

  1. Move the wp-config file one level outside the root. WordPress knows to look for the file there.

  2. Make sure your server is hiding your root/parent index. That’s an option you can usually change yourself in cpanel.