I have created a new Ubuntu server and in root user, I created a new user. The steps I followed:
sudo adduser tom sudo su - tom mkdir .ssh chmod 700 .ssh touch .ssh/authorized_keys chmod 600 .ssh/authorized_keys nano .ssh/authorized_keys // paste public key
It seems okay and I can login as
firstname.lastname@example.org. However when I logged in as Tom, it asks for permission and when I sudo something it asks for password, and I don't have a password for him so I use my root password, so it warns:
[sudo] password for tom: tom is not in the sudoers file. This incident will be reported.
From my root user, I tried adding tom in
root ALL=(ALL:ALL) ALL tom ALL=(ALL:ALL) ALL
but this didn't change anything.
What is the proper way of this setup so Tom has permission to run stuff and the only password asked to him is his ssh password? Tom should run stuff like
sudo npm install or
sudo composer install with his ssh password and maybe he shouldn't even know root password
What am I missing here?