Skip to content

Grant Root privileges on Ubuntu

Method 1

Add the user to the root group.

sudo groupmod -G root user_name

Method 2

Edit passwd file. Set user’s UID & GID to 0.

sudo vi /etc/passwd

Following is the content of ‘/etc/passwd’. We can see that user_name’s UID & GID are both 1001. Set them to 0 and save.

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
user_name:x:1001:1001::/home/user_name:/bin/sh

Leave a Reply