New user on newly created server, added to sudo group but still no sudo access

cn flag

I created a new server (ubuntu-s-2vcpu-2gb-nyc1-01) with Ubuntu 22.04 and added a new user (michael). I then added the user to the sudo group. When I check the groups for michael I see the correct groups.

root@ubuntu-s-2vcpu-2gb-nyc1-01:/srv/users/michael# groups michael
michael : michael sudo sp-sysusers

But every time I try to run a sudo command I get the same message:

michael@ubuntu-s-2vcpu-2gb-nyc1-01:~$ sudo cd /
You must SSH in as root to run this command: sudo cd /

I checked /etc/passwd to ensure the user was added right


I checked /etc/sudoers and all looks correct

# User privilege specification
root    ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

I've restarted the machine multiple times. Logged off michael and even tried pkill -STOP -u michael but still no luck upon reboot. I've been at this for hours running in circles. What am I missing?

sudodus avatar
jp flag
You can't run `sudo cd` because `cd` is a shell built-in. Try to run some other command, for example `sudo fdisk` or `sudo parted`.
Michael Goodin avatar
cn flag
@sudodus same thing: michael@ubuntu-s-2vcpu-2gb-nyc1-01:~$ sudo parted You must SSH in as root to run this command: sudo parted
hr flag
*"created a new server"* how exactly? The message `You must SSH in as root to run this command` looks like something implemented by a VPS provider.
cn flag
@MichaelGoodin you are using ssh with a none-admin user. Oh and you can not use sudo using the root account either; if you want an admin account add "michael" (name in the command prompt)
cn flag

I fixed the issue but I'm still not sure why it worked. I used to install the server framework AND to add the user michael. I then used sudo to change michael's privileges. It never worked until I removed michael and readded using sudo instead of

My guess is that michael was added to another group, that I was ignoring, which caused it not to have true sudo priv's.

Moral of the story, don't use to create admin-level users.

I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.