I am using a Debian 9 server.
Usually I access via ssh to a normal user (say user1) and su into root, because I disabled ssh into root.
Lately I was setting up a git-server where I created a user git with the group git and restricted him to git-shell.
Playing around a little while I added user1 to the group git like this:
usermod -aG git user1
This worked alright, user1 was member of the groups user1 and git.
At the end I wanted to undo this, so I used:
usermod -G user1 user1
Shortly after this, I lost my internet connection and had to reconnect. I can ssh into user1 alright, but when using su to access root, there is an error:
user1@hostname:~$ su
Password:
Cannot execute git: No such file or directory
user1@hostname:~$
I included the information about git-shell, because I have no idea what else could be the reason. Hopefully it is not all lost and somebody can help me to regain control.
PS: There isn't any other root-like user, so sudo isn't working, since user1 "is not in the sudoers file".
PPS: I could reset the root password via VPS-login, but I am not quite sure whether this is going to work or make everything worse.