User/Group Name Change to IDs Using Unison?

Discussion in 'Installation/Configuration' started by jaypabs, Jun 30, 2022.

  1. jaypabs

    jaypabs Member

    I just created two servers using MySQL master-master replication. Both servers have all the services running (nginx, MySQL, emails, DNS).

    The synchronization of websites configuration is okay.

    But the problem is the user/group name of a files and folders changes from the correct name to User/Group IDs when I run Unison. I carefully followed the tutorial from ISPConfig manual.

    Here's an example of the what happen when I sync it using Unison:

    [​IMG]
    [​IMG]
    [​IMG]
    Another problem I encounter on master server after running unison is I can't su - user. It returns permission denied. Here it is:

    [​IMG]
    But it works fine in slave server.

    Any idea what's wrong with this?

    Thanks in advance for any help.
     

    Attached Files:

  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Most likely you missed activating the option to connect userid to the web id under system > server config web. This must be set for any mirror system before you add the first website, it can not be fixed by changing it later without deleting all sites.
     
  3. jaypabs

    jaypabs Member

    I have already set that on both server.

    Please see attached screenshot:
    [​IMG]
     

    Attached Files:

  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Are you sure that you set it before you created the first site?
     
  5. jaypabs

    jaypabs Member

    Yes. I followed the instruction from top to bottom of the manual.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Hmm, ok. That's strange indeed. Please have a look in the /etc/passwd file on both servers, is the web1 user present in both of them and if yes, does it has the same ID on both systems?
     
  7. jaypabs

    jaypabs Member

    They don't have the same IDs.
    Maybe I forgot I created a sample website before I set the permissions.
    Anyway, is there a solution for this? Can I just copy/paste the content of password file from master to slave? Will there be no conflict after that?
     
  8. jaypabs

    jaypabs Member

    Hi,
    I deleted all websites, clients and other stuff and created a new one. It's working fine now.

    Thank you very much for the help.

    I really appreciate it.
     
    till likes this.
  9. jaypabs

    jaypabs Member

    Hi @till,
    Follow up question:
    Currently, I tested mirroring setup on my LAN.
    Can I create a slave server in addition to my current server with existing websites?
    Existing server will be the master server and additional server will be the slave.
    Because if not, I have to setup two servers just to create a mirroring setup.
    I was aware now that I need to set the option to connect userid to the web id under system > server config web which of course I did not do this when I setup my server.
    So, I'm thinking I cannot use my existing server to be the master. Unless there's a workaround with this.
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    It is possible with an existing server by using a little trick. You must copy over all webID users and clientID groups from files /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow to the new server (plus other ssh users that you might have created in the websites). When ispconfig creates a new site (or in this case recreates the sites), then it reuses these users and keeps their id's, so by copying them upfront, the id's will be the same on both systems.
     
  11. jaypabs

    jaypabs Member

    Thanks for the tip. I will try this approach.
     
  12. jaypabs

    jaypabs Member

    Hi @till
    I created a testing server that will simulate my live server (i.e. having an existing data) and created a slave server.

    I followed your instruction to edit /etc/passwd, /etc/shadow, /etc/group and /etc/gshadow to have an identical webID and clientID.

    When running unison for the first time, this is the error I encounter:
    unison error.png

    Though the synching of files and folders has the same user/group name as seen below:
    server 1 and 2.png
    The problem is I can't change shell user as follows:
    su user permission denied.png

    The error is permission denied. I can't also add files in the folder under web on both servers.

    Here's the content of vipw and vigr. The top one is server1 and at the bottom is server2:
    VIPW:
    vipw.png
    VIGR:
    vigr.png

    I created a new website, shell user, db user and db name and put wordpress in it without any problem.

    I hope you can give me another information on how to resolve this issue. As I can't create two servers to install a clean websites from scratch. I really need to use the existing server and just add a slave server.

    Thanks in advance for any help.
     
  13. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    If ISPConfig created those website directories, they are made immutable with chattr. Examine with
    Code:
    lsattr /var/www/clients/*
    Would it not be easier to cut and paste the listings in CODE tags, and not those screenshot images?
     
  14. jaypabs

    jaypabs Member

    Hi,
    Can you please elaborate what you mean?

    Executing lsattr /var/www/clients/* returns the following:

    Code:
    root@server1:~# lsattr /var/www/clients/*
    lsattr: Operation not supported While reading flags on /var/www/clients/client1/example1.com
    ----i---------e----- /var/www/clients/client1/web1
    lsattr: Operation not supported While reading flags on /var/www/clients/client1/example2.com
    lsattr: Operation not supported While reading flags on /var/www/clients/client1/example3.com
    ----i---------e----- /var/www/clients/client1/web5
    ----i---------e----- /var/www/clients/client1/web2
    ----i---------e----- /var/www/clients/client2/web3
    lsattr: Operation not supported While reading flags on /var/www/clients/client2/example4.com
     
  15. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    You need to read man page for chattr.
    The i indicates file is immutable, so it can not be modified unless first immutable is removed with chattr.
     

Share This Page