Linux – regular user to admin user in linux

linuxUbuntu

i've got a regular user i want to turn into admin group so he can have same privileges as a root.

should i just change the GID in /etc/passwd and /etc/group or should i use usermod/groupmod?

Best Answer

You do not want to make this user EXACTLY the same as root. Don't change uid and gid. You have a few options:

  • Use sudo. sudo lets a user execute a command or start a shell as root, without needing the root password. However, the admin of the computer can tightly control which commands a user can "sudo". Read up the man page. But if you want an easy "let this user run any thing with sudo", put this user in the /etc/sudoers file. Even better, put this user in the admin group then add the line %admin ALL=(ALL) ALL to /etc/sudoers. On Ubuntu, this is probably your best option as sudo is installed by default.

  • Put this user in the wheel or admin group. This user won't be root, but will have the same access to files as everyone else in wheel or admin.

  • Give the user the root password and make this user use su <cmd>. This is a bad idea. On recent versions of Ubuntu, the root account can't login by default so you can't do this.

Related Question