Source

Portfolio / hacktuts / vsftpd / modified-anon-howto.txt

Full commit
####
How do I use a different user other than ANONYMOUS for VSFTPD?
####

You can modify line 178 in prelogin.c with the desired user:

<code>
  ...
  int is_anon = 1;
  str_copy(&p_sess->user_str, &p_sess->ftp_arg_str);
  str_upper(&p_sess->ftp_arg_str);
  if (!str_equal_text(&p_sess->ftp_arg_str, "FTP") &&
      !str_equal_text(&p_sess->ftp_arg_str, "NEW_USER_GOES_HERE"))
  {
    is_anon = 0;
  }
  ...
</code>

and modify line 296 in privops.c:

<code>
  ...
  /* Check for an anonymous login or "real" login */
  if (tunable_anonymous_enable)
  {
    struct mystr upper_str = INIT_MYSTR;
    str_copy(&upper_str, p_user_str);
    str_upper(&upper_str);
    if (str_equal_text(&upper_str, "FTP") ||
        str_equal_text(&upper_str, "NEW_USER_GOES_HERE"))
    {
      anonymous_login = 1;
    }
    str_free(&upper_str);
  }
  ...
</code>

Then modify the version number to match your custom version in vsftpver.h:

<code>
  #ifndef VSF_VERSION_H
  #define VSF_VERSION_H

  #define VSF_VERSION "2.2.1-my-new-version"

  #endif /* VSF_VERSION_H */
</code>

Then compile and configure the conf file /etc/vsftpd.conf like the one in this directory.