Admin lost permissions after backup restore

My YunoHost server

Hardware: Old laptop or computer
YunoHost version: Latest
I have access to my server : Through SSH | through the webadmin | direct access via keyboard / screen | …

I needed to change the hardware of my yunohost server.

On the old machine I did a Yunohost backup.

On the new machine I installed Debian. Then I installed Yunohost through the installation script. Then restored system and apps. Rebooted.

Almost everything seems to work now. I can log into the server’s terminal as root without a problem. But when logging in the server’s terminal with “myuser”, which was admin, now it does not have sudo permissions:

myuser@mydefaultsubdomain:~$ sudo apt update
myuser is not allowed to run sudo on mydefaultsubdomain. This incident will be resported.

And, when I’m on my desktop, I cannot SSH into the server:

desktopuser@desktop:~$ ssh myuser@mydomain.tld
myuser@mydomain.tld: Permission denied (publickey).

And what it’s weirdest: I can perfectly log into the web admin with myuser !!

I am suspecting that, before the Yunohost installation, during the Debian installation wizard, when it asks for a user, perhaps I used the same “myuser” and that could be giving some problem now??

Anyway I still don’t know how to troubleshoot it…

fist of all, I guess you should use the webUI to create another user (not the same name), make this user admin, and test it for ssh and sudo. At least you won’t lock yourself out when trying to solve it.

If that works, yes, I guess there’s been a mixup between the debian user, and the original one in yunohost.

Second, do you still have access to your old server’s files, maybe useful for recovering past configs perhaps (ssh keys?).

Hey, thank you for your message.

Yes, that would definitely be a solution, but the thing is my user is admin on many services and I’m afraid it could be problematic to delete it (and for now I prefer to avoid having several users for myself). I’d rather find out where exactly the problem is and fix it, I guess it must be something simple…

If I cannot make it, I’ll go for your solution.

I never said you should delete your user, simply to create another one to make sure you don’t get locked out. ¯_(ツ)_/¯

Perhaps you can try yunohost cli

yunohost user group add admins mysuser
yunohost user info myuser
yunohost user group list

for ssh, if needed, you can simply add the folders like this

~# su - myuser
myuser@mydomain.tld:~$ mkdir ~/.ssh
myuser@mydomain.tld:~$ chmod 700 ~/.ssh
myuser@mydomain.tld:~$ touch ~/.ssh/authorized_keys
myuser@mydomain.tld:~$ chmod 600 ~/.ssh/authorized_keys

In the file authorized_keys you can copy-paste your public key ssh from your user in your desktop computer

on your desktop computer

desktopuser@desktop:~$ cat ~/.ssh/id_rsa.pub

Also if needed you can reload the service

yunohost service reload ssh

Thank you @rodinux for your message
I checked all that (I should have mentioned it in my first post, apologies) and everything was ok. It is a mysterious thing…

I guess I’ll go for fabulousfabs workaround.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.