Solved Directadmin Admin User Deleted by root

Tpark

Verified User
Joined
Nov 2, 2018
Messages
28
Hi
Our Software developer mistakenly deleted "admin" user by "root" in ssh so I add it back by adduser.

I've noticed that my "User Packages" are gone, so I created Packages again and reassign users with new packages.
The Problem is: When I want to create new "User Package", "SSL" and "SSH" options missing in create package.
And also "SSL" and "SSH" options missing in users "Modify" page.
Therefore,
All sites that using SSL stopped working after reassigning new user packages to users.
Users didn't have "Secure SSL" in "Domain Setup" to enable ssl.

Screenshot 2022-03-07 205534.jpg

I've read old threads with the same problem, There is no solution provided in any of them.
Cloudlinux 8.5
Directadmin 1.63.7
Any Help will be greatly appreciated
 
Last edited:
Will reinstalling DA
it takes just a bit to run. It just rebuilding the da executable. Its not a Setup reinstall.
zero downtime?
Zero is a big if.. Deleting the admin user causes much more issue.
Will anything/any USERS data be lost?
I would always make a backup and snapshot first.
Script only for creating admin user
Its not installing like you did when you first setup the box. Its just the Directadmin executable.

If you need real support follow this https://forum.directadmin.com/threads/how-to-ask-for-help-here-on-the-forum.63312/
 
Depending on how the admin user was deleted (and with it any files, specially those under /usr/local/directadmin), it may be as simple as making sure the new admin user/group has the same uid/gid as before, if they're not already.
 
This is solution for everyone who have same problem:

This solution worked for me, It may not work for you.
So please backup everything before every file edit and do this at your own risk.

  1. add "admin" user back:
    1. # adduser admin
    2. # passwd admin ==> change "admin" password
  2. change gid and uid "admin" user back to the original DA "admin":
    1. # id admin ==> check current uid and gid and groups
    2. # getent passwd 1001 ==> check if any users use 1001 uid, if yes، change it to another uid.
    3. # getent group 1002 ==> check if ay groups use 1002 gid, if yes, change it to another gid.
    4. # usermod -u 1001 -g 1002 admin ==> change admin uid and gid to DA Defaults.
    5. # id admin ==> check uid and gid again and pay attention to groups.
  3. if you didn't sure about "admin" directories or directories also deleted:
    1. #cd /usr/local/directadmin/scripts
    2. ./fix_da_user.sh admin admin
  4. check /home/admin/... files and directores to be owend by "admin:admin"
  5. Edit file:
    1. # vi /usr/local/directadmin/data/users/admin/reseller.conf
    2. Change "OFF" to "ON" for everything.
    3. Check the other values to be correct
  6. Recreate user Packages from "Dashboard / Manage User Packages -> + Add Package"
  7. If SSH and SSL disabled for current users use command below:
    1. # perl -pi -e 's/ssl=OFF/ssl=ON/' /usr/local/directadmin/data/users/*/packages/*.pkg
    2. # perl -pi -e 's/ssl=OFF/ssl=ON/' /usr/local/directadmin/data/users/*/user.conf
    3. # perl -pi -e 's/ssl=OFF/ssl=ON/' /usr/local/directadmin/data/users/*/domains/*.conf
    4. Restart Directadmin and Httpd
  8. If you are Cloudlinux user:
    1. # /usr/share/l.v.e-manager/install-lvemanager-plugin.py -u
    2. Reconfigure Packages Limit in LVE Manager.
  9. Re-assign all users Package via "Dashboard / Show Users / View User ==> Modify / Set Package to"
 
Back
Top