-1

I've created a user on a server where there was only root as:

# adduser user1

with a password. Then

# su - user1

And then:

$ apt-get update
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
user1@my_server:~$ sudo apt-get update
[sudo] password for user1:
user1 is not in the sudoers file.  This incident will be reported.

I believe I've missed something such as add some privileges or something like that.

How to fix that?

Oskar K.
  • 551
  • 1
  • 6
  • 18

1 Answers1

1

Where we would get, if every new user would be able to sudo by default? This is administrator privilege. Ubuntu is using group sudo to give users this privilege.

If you want to allow user to run sudo for everything, add him to the sudo group:

useradd -G sudo user1

If you want to limit the user more, you should check how sudoers file look like and adjust it to your needs using

visudo
Jakuje
  • 21,357