I made a new user on my Raspberry Pi for myself and it keeps asking for my password when I do things like
sudo apt-get install. How do I make it an administrator?
You can manually add the user to
sudoers, but this is only part of the story.
If you want the user to have the same privileges you should set the groups.
pi user is normally a member of
pi adm dialout cdrom sudo audio video plugdev games users input netdev gpio i2c spi
This can be done with the following command (replace username with the actual name).
for GROUP in $(groups pi | sed 's/.*:\spi//'); do sudo adduser username $GROUP; done
sed command is there to remove group
pi so the new user does not share files with
NOTE editing the sudoers file is NOT recommended - many have broken their systems by getting this wrong.
On Raspbian you have two common options:
Option 1: Add the already created user (i.e. with the name "john") to the group "sudo":
pi@raspberry:~ $ sudo usermod -aG sudo john
Option 2: Edit the sudoers file:
pi@raspberry:~ $ sudo visudo
By default you'll find this line (do not remove/overwrite it):
root ALL=(ALL:ALL) ALL. Just add
john ALL=(ALL:ALL) ALL' or, if you want passwordless root access, add
john ALL = NOPASSWD: ALL.
visudo provides basic sanity checks, parses the sudoers file after your edit and will not save your changes if there is a syntax error. I'd not recommended to use other tools like nano for this job.
Reboot is not required, but for security reasons only a sudoer user can make these changes.