Create admin user: Difference between revisions

From Jwiki
No edit summary
No edit summary
Line 52: Line 52:
* All commands require root/sudo privileges on your Proxmox host.
* All commands require root/sudo privileges on your Proxmox host.


[[Category:Proxmox]]
[[Category:Proxmox VE]]

Revision as of 09:59, 27 August 2025

Install sudo on Proxmox

1. Install sudo (if not present)

apt update && apt install sudo

2. Create an Administrative User

The script below will:

  • Create a new user (replace asd and password as needed).
  • Add the user to the sudo group.
  • Create an admin group in Proxmox's user management.
  • Assign the Administrator role.
USER="asd"
PASS="asd"
COMMENT="System Administrator"
if ! id "$USER" &>/dev/null; then
  sudo useradd -m -s /bin/bash -G sudo "$USER" && echo "$USER:$PASS" | sudo chpasswd
fi
pveum groupadd admin --comment "${COMMENT} group" 2>/dev/null
pveum aclmod / --group admin --role Administrator
pveum useradd "${USER}@pam" --comment "${COMMENT}" --groups admin 2>/dev/null

3. Remove the Created User and Group

To delete the user and associated group:

USER="asd"
sudo deluser --remove-home "$USER"
pveum user delete "${USER}@pam" 2>/dev/null
pveum group remove admin 2>/dev/null

4. (Optional) Disable Root GUI Access

For enhanced security, disable root login for the Proxmox web GUI:

pveum user modify root@pam --enable 0

To re-enable root access to GUI:

pveum user modify root@pam --enable 1

Notes:

  • Change all hardcoded credentials before using in production!
  • Assigning Administrator to a non-root user allows you to safely disable root UI access.
  • All commands require root/sudo privileges on your Proxmox host.