Discover Centmin Mod today
Register Now

Nginx Set wrong domain, deleted it but FTP remains

Discussion in 'Install & Upgrades or Pre-Install Questions' started by elargento, Mar 27, 2017.

  1. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    8:48 AM
    10
    • CentOS Version: CentOS 7 64bit
    • Centmin Mod Version Installed: 123.09beta01
    Hi,

    I made a mistake in step 2 (Add Nginx vhost domain) where I set just "domain" instead of "domain.com". Then I created a FTP user.
    When I noticed the problem I run step 2 again and set "domain.com" with same FTP username. The problem is that centmin never asked me to rewrite the old FTP account so I'm unable to upload files to domain.com because the FTP is configured for domain .

    Is there any way to delete the old FTP account and use the same FTP username for the new vhost domain?
     
  2. Jimmy

    Jimmy Premium Member Premium Member

    1,114
    247
    63
    Oct 24, 2015
    East Coast USA
    Ratings:
    +596
    Local Time:
    7:48 AM
    1.13.x
    MariaDB 10.1.x
    Pure-FTPD Virtual FTP Users - CentminMod.com LEMP Nginx web stack for CentOS

    Change Pure-FTPD Username Or Password
    Centmin Mod auto generated Nginx vhosts have an accompanying Pure-FTPD virtual ftp username and password generated as well. You can use pure-pw command to change the ftp username and password. The pure-pw manual is here and http://download.pureftpd.org/pub/pure-ftpd/doc/README.Virtual-Users

    list all pure-ftpd created virtual FTP users
    Code:
    pure-pw list
    to delete virtual FTP user
    Code:
    pure-pw userdel FTPUSERNAME
    pure-pw mkdb
    change virtual FTP user's password
    Code:
    pure-pw passwd FTPUSERNAME
    pure-pw mkdb
    show full details for an specific pure-ftpd virtual FTP user
    Code:
    pure-pw show FTPUSERNAME
     
    • Informative Informative x 1
    • Useful Useful x 1
  3. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    8:48 AM
    10
    Need to read MORE. All the information is in the FAQ. It's too much information and seems to be much easier to ask.

    Wouldn't be a bad idea to display a warning saying something like "the FTP username you are trying to set was already created".


    Thank you.
     
  4. Jimmy

    Jimmy Premium Member Premium Member

    1,114
    247
    63
    Oct 24, 2015
    East Coast USA
    Ratings:
    +596
    Local Time:
    7:48 AM
    1.13.x
    MariaDB 10.1.x
    You can always use the search feature on the main site, that usually yields good results. That's what I did.

    Also, when you create the vhost, how to remove the user is in the output information. So, next time just copy all the info when you create a vhost.
     
    • Like Like x 1
    • Agree Agree x 1
  5. eva2000

    eva2000 Administrator Staff Member

    30,180
    6,786
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,139
    Local Time:
    9:48 PM
    Nginx 1.13.x
    MariaDB 5.5
    Yup official centminmod.com site + forums have most the info folks need to solve there problems now just a matter of search and reading - How to delete Nginx vhost account for existing domain/subdomain ?

    Each nginx vhost created at the end of output and for logged entry in /root/centminlogs saved as a nginx_addvhost.log timestamped and has the list of commands to fully remove a nginx vhost as outlined at Nginx Vhost & NSD DNS Setup - CentminMod.com LEMP Nginx web stack for CentOS

    You can use command to list all nginx_addvhost logs
    Code (Text):
    find /root/centminlogs -type f -name "*nginx_addvhost*"
    

    i.e.
    Code (Text):
    find /root/centminlogs -type f -name "*nginx_addvhost*"
    /root/centminlogs/centminmod_1.2.3-eva2000.09.004_200317-040926_nginx_addvhost.log
    


    in centmin mod 123.08stable nginxaddvhost.log and at end of create new nginx vhost site creation you see
    Code (Text):
    Commands to remove newdomain.com
    
     rm -rf /usr/local/nginx/conf/conf.d/newdomain.com.conf
     rm -rf /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
     rm -rf /usr/local/nginx/conf/ssl/newdomain.com/newdomain.com.crt
     rm -rf /usr/local/nginx/conf/ssl/newdomain.com/newdomain.com.key
     rm -rf /usr/local/nginx/conf/ssl/newdomain.com/newdomain.com.csr
     rm -rf /home/nginx/domains/newdomain.com
     service nginx restart
    

    in centmin mod 123.09beta01 nginxaddvhost.log and at end of create new nginx vhost site creation you see the above + additional command to remove ftp created user
    Code (Text):
    Commands to remove newdomain.com
    
     pure-pw userdel YOURFTPUSERNAME
     rm -rf /usr/local/nginx/conf/conf.d/newdomain.com.conf
     rm -rf /usr/local/nginx/conf/conf.d/newdomain.com.ssl.conf
     rm -rf /usr/local/nginx/conf/ssl/newdomain.com/newdomain.com.crt
     rm -rf /usr/local/nginx/conf/ssl/newdomain.com/newdomain.com.key
     rm -rf /usr/local/nginx/conf/ssl/newdomain.com/newdomain.com.csr
     rm -rf /home/nginx/domains/newdomain.com
     service nginx restart
    


    Also see https://community.centminmod.com/threads/guide-to-learning-more-about-centmin-mod.10838/ and Pure-FTPD Virtual FTP Users - CentminMod.com LEMP Nginx web stack for CentOS ;)
     
    Last edited: Mar 27, 2017
  6. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    8:48 AM
    10
    I run
    Code:
    find /root/centminlogs -type f -name "*nginx_addvhost*"
    and found the following file:
    /root/centminlogs/centminmod_1.2.3-eva2000.09.004_270317-014130_nginx_addvhost.log

    However when I open it with nano I get the following:
    Code:
    ^[[1;33;40m---------------------------------------------
    ^[(B^[[m
    ^[[1;33;40m---------------------------------------------------------------
    ^[(B^[[m^[[1;32;40mImportant Information
    ^[(B^[[m^[[1;33;40m------------------------------------------------------------$
    ^[(B^[[m
    You are about to create an Nginx vhost site account with/without
    HTTPS/SSL support. Details of this process are outlined on site
    at centminmod.com/nginx_domain_dns_setup.html. Also read the
    continually updated Getting Started Guide for Centmin Mod usage
    at centminmod.com/getstarted.html which covers the pure-ftpd
    ftp username that is auto generated with the Nginx vhost site.
    
    Do you want to continue with Nginx vhost site creation ? [y/n] n
    
    aborting Nginx vhost setup...
    
    Where can I see the commands to remove a domain from vhost if I open the file with nano and can't read it?
     
  7. eva2000

    eva2000 Administrator Staff Member

    30,180
    6,786
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,139
    Local Time:
    9:48 PM
    Nginx 1.13.x
    MariaDB 5.5
    • Like Like x 1
  8. elargento

    elargento Member

    293
    16
    18
    Jan 4, 2016
    Ratings:
    +39
    Local Time:
    8:48 AM
    10
    I get
    Code:
    Error.
    Check that [quieromipeliculahd] already exists,
    and that [/etc/pure-ftpd/pureftpd.passwd.tmp] can be written.
    
     
  9. eva2000

    eva2000 Administrator Staff Member

    30,180
    6,786
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,139
    Local Time:
    9:48 PM
    Nginx 1.13.x
    MariaDB 5.5