Preserve User & Group While Moving Files to New Server

Discussion in 'General' started by Taxi, Oct 6, 2022.

  1. Taxi

    Taxi Member

    Dear Forum

    I rsynced /var/www from an old installation to a new one.
    When I'm looking to the directory:
    ls -l /var/www/
    lrwxrwxrwx 1 root root 30 Nov 12 2020 christianroth.ch -> /var/www/clients/client1/web4/

    I see all symlinks to the client and web directory. All good so far.

    When I'm changing into the directory, I see another web and client as owner and group for this site.
    mars:/var/www# cd christianroth.ch
    mars:/var/www/christianroth.ch# ls -l
    total 44
    drwxr-xr-x 2 web5 client4 4096 Nov 13 2020 backup
    drwxr-xr-x 2 web5 client4 4096 Nov 12 2020 cgi-bin
    d--------x 2 root root 4096 Nov 29 2020 etc
    drwxr-xr-x 2 web5 root 4096 Feb 11 2022 home
    drwxr-xr-x 2 root root 4096 Oct 6 02:01 log
    drwx--x--- 2 web5 client4 4096 Nov 12 2020 private
    drwxr-xr-x 2 root root 4096 Dec 16 2020 ssl
    drwxrwx--- 2 web5 client4 4096 Aug 30 22:32 tmp
    drwxr-xr-x 4 root root 4096 Nov 29 2020 var
    drwx--x--x 9 web5 client4 4096 Sep 20 18:39 web
    drwx--x--- 2 web5 client4 4096 Nov 12 2020 webdav

    Where comes this difference from?

    In the new ISPConfig Panel I'm seeing the right path under Sites -> Web Domain -> Domain
    Document Root: /var/www/clients/client1/web4
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Might be that you missed copying over the web* users and client* groups from passwd, group, shadow, and shadow files of the system? There are posts here in the forum about moving an ISPConfig installation to a new server that describe all the steps. You cannot just copy over the data and ispconfig database, this will not work.
     
  3. Taxi

    Taxi Member

    Yes, I did the migration according to the documents.
    Could it be that the problem is, that I installed ISPConfig on the new server before migrating the data?
    Now I copied the /etc/passwd and /etc/shadow.

    Somehow now ISPConfig can't access the DB, or maybe I'm misunderstanding the apache2 error.log.
    Login credentials in /usr/local/ispconfig/server/lib/mysql_clientdb.conf
    are correct.

    /var/log/apache2/error.log shows:
    [Thu Oct 06 21:24:05.366848 2022] [fcgid:warn] [pid 1120440:tid 140294382290688] [client 31.10.154.56:54014] mod_fcgid: stderr: PHP Warning: mysqli_real_connect(): (HY000/1045): Access denied for user 'ispconfig'@'localhost' (using password: YES) in /usr/local/ispconfig/interface/lib/classes/db_mysql.inc.php on line 91

    The user ispconfig has all rights, on the database dbispconfig.
    I can connect manually to the database via mysql -u ispconfig
    And also an ispconfig_update.sh --force run through without errors.

    I can't see the ISPConfig Panel. The page is blank.

    Another point is that the /etc/init.d/ispconfig_server script is missing, therefore I don't know how to restart, stop and start the server.

    System is Debian 11, bullseye
    ISPConfig is 3.2.8p2

    Here the test script results:

    ##### SERVER #####
    IP-address (as per hostname): ***.***.***.***
    [WARN] could not determine server's ip address by ifconfig
    [INFO] OS version is Debian GNU/Linux 11 (bullseye)
    [INFO] uptime: 22:49:12 up 3 days, 10:04, 1 user, load average: 0.05, 0.16, 0.12
    [INFO] memory:
    total used free shared buff/cache available
    Mem: 31Gi 2.2Gi 871Mi 109Mi 28Gi 28Gi
    Swap: 7.6Gi 1.0Mi 7.6Gi
    [INFO] systemd failed services status:
    UNIT LOAD ACTIVE SUB DESCRIPTION
    ● mailman3.service loaded failed failed Mailman3 server
    ● openipmi.service loaded failed failed LSB: OpenIPMI Driver init script
    ● rc-local.service loaded failed failed /etc/rc.local Compatibility

    LOAD = Reflects whether the unit definition was properly loaded.
    ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
    SUB = The low-level unit activation state, values depend on unit type.
    3 loaded units listed.

    [INFO] ISPConfig is installed.

    ##### ISPCONFIG #####
    ISPConfig version is 3.2.8p2


    ##### VERSION CHECK #####

    [INFO] php (cli) version is 7.4.32
    [INFO] php-cgi (used for cgi php in default vhost!) is version 7.4.32

    ##### PORT CHECK #####


    ##### MAIL SERVER CHECK #####


    ##### RUNNING SERVER PROCESSES #####

    [INFO] I found the following web server(s):
    Apache 2 (PID 1161131)
    [INFO] I found the following mail server(s):
    Postfix (PID 1160869)
    [INFO] I found the following pop3 server(s):
    Dovecot (PID 1161080)
    [INFO] I found the following imap server(s):
    Dovecot (PID 1161080)
    [INFO] I found the following ftp server(s):
    PureFTP (PID 1161189)

    ##### LISTENING PORTS #####
    (only ()
    Local (Address)
    [localhost]:10023 (45320/postgrey)
    [localhost]:10024 (1160947/amavisd-new)
    [localhost]:10025 (1160869/master)
    [localhost]:10026 (1160947/amavisd-new)
    [localhost]:10027 (1160869/master)
    [anywhere]:587 (1160869/master)
    [localhost]:11211 (138721/memcached)
    [localhost]:6379 (45078/redis-server)
    [anywhere]:110 (1161080/dovecot)
    [anywhere]:143 (1161080/dovecot)
    [anywhere]:8080 (1161131/apache2)
    [anywhere]:80 (1161131/apache2)
    [anywhere]:8081 (1161131/apache2)
    [anywhere]:465 (1160869/master)
    ***.***.***.***:53 (1161305/named)
    ***.***.***.***:53 (1161305/named)
    ***.***.***.***:53 (1161305/named)
    ***.***.***.***:53 (1161305/named)
    [localhost]:53 (1161305/named)
    [localhost]:53 (1161305/named)
    [localhost]:53 (1161305/named)
    [localhost]:53 (1161305/named)
    [anywhere]:21 (1161189/pure-ftpd)
    [anywhere]:22 (653/sshd:)
    [localhost]:953 (1161305/named)
    [anywhere]:25 (1160869/master)
    [anywhere]:443 (1161131/apache2)
    [anywhere]:4190 (1161080/dovecot)
    [anywhere]:993 (1161080/dovecot)
    [anywhere]:995 (1161080/dovecot)
    [localhost]:11332 (1160994/rspamd:)
    [localhost]:11333 (1160994/rspamd:)
    [localhost]:11334 (1160994/rspamd:)
    *:*:*:*::*:3306 (1160059/mariadbd)
    *:*:*:*::*:587 (1160869/master)
    [localhost]10 (1161080/dovecot)
    [localhost]43 (1161080/dovecot)
    *:*:*:*::*:465 (1160869/master)
    *:*:*:*::*:21 (1161189/pure-ftpd)
    *:*:*:*::*:22 (653/sshd:)
    *:*:*:*::*:25 (1160869/master)
    *:*:*:*::*:4190 (1161080/dovecot)
    *:*:*:*::*:993 (1161080/dovecot)
    *:*:*:*::*:995 (1161080/dovecot)




    ##### IPTABLES #####
    Chain INPUT (policy ACCEPT)
    target prot opt source destination

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination




    ##### LET'S ENCRYPT #####
    Certbot is installed in /usr/bin/letsencrypt
     
    Last edited: Oct 6, 2022
  4. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    And /etc/group?
    My ISPConfig server does not have that file. I believe there should not be such a file, ISPConfig does not run as a service.
    Test script showed three failing services, though.
    Recently installed ISPConfig systems have acme.sh as LE client.
     
    ahrasis likes this.
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    First, the files may not be copied completely, you just copy the necessary web users and client groups. copying the whole files likely breaks the system. Installing ISPConfig before you copy the users and groups is fine, but you may not copy any website data upfront and especially not the ispconfig database from old system and do a resync. after you run a resync in ISPCofig without having copied the users and groups, new users with different ID#s will get created, so you can not fix it anymore afterwards easily.
     
    ahrasis likes this.
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig is not using the login details in that file on a regular basis, the login details in this file are only used for creating new MySQL users and databases. The MySQL login details for ISPConfig itself are in the two config.inc.php files.

    There is no such file in ISConfig 3 like @Taleman mentioned. ISPConfig 2 had such a file, but that was a completely different software that is eol for more than 15 years, so if you follow a guide that mentions that file, then the guide is not compatible with your system.
     
    ahrasis likes this.
  7. Taxi

    Taxi Member

    Many thanks for your help!

    Yes, the group aswell.
    And yes, I just copied the web and client lines not the whole file.

    Strange. The installation on the old server hat this directory under /root/.acme.sh/
    Although on the new system it is missing I could see the Letsencrypt certificate on one webpage, yesterday, while ISPConfig was running, before I messed it up with copying the lines in /etc/passwd, /etc/shadow and /etc/group
     
    Last edited: Oct 7, 2022
  8. Taxi

    Taxi Member

    Many thanks for your help!
    Under the installation directory, I have no config.inc.php files.
    I found one under /etc/phpmyadmin/ but there are no ispconfig credentials.
    Another is under /etc/roundcube/

    Okay, than I have to kill the process and hope that it will come up again?

    Maybe the best is to reinstall ISPConfig again.
    But how do I get rid of the old installation? I found a document that mentions an ispconfig_uninstall.sh script. But there is no such for the new version.
     
  9. Taxi

    Taxi Member

    Update:
    I found the data base credentials under
    /usr/local/ispconfig/interface/lib/config.inc.php

    Now ISPConfig works again.
    I did a resync.
     
    Last edited: Oct 7, 2022
    ahrasis likes this.
  10. Taxi

    Taxi Member

    Update 2:
    I did a new installation.
    ISPConfig Panel seems to work so far. Roundcube as well. :)
    Many thanks for all your support!
     
    ahrasis likes this.
  11. Taxi

    Taxi Member

    Another question:
    On the new Server I'm missing the /root/.acme.ch/ certificates.
    My experience is that ISPConfig does not create them, if their are missing, korrekt?
    I then uncheck the box SSL and Let's Encrypt SSL, wait till the process is trough.
    Then I check check SSL and Let's Encrypt SSL and then the certificates are created. This works!

    Conclusion:
    Certificates are only created, or renewed, if they are already issued and stored on the ISPConfig server.
    Cron does not create them, only updates them, correct?
     

Share This Page