Mistakenly added user 'ubuntu' to a chroot group and cant login to server anymore

0

Ok, So I have an ubuntu server setup with SFTP chroot. So, any user added to the group 'sftpusers' will be only able to use sftp commands on the server, today while testing rsync, i didnt think and added ubuntu user to the sftp group and cant ssh into the server anymore.

There are no other users which I can use to login to the server and undo this mess, Is there any way that I can fix this???

Based on my understanding, there is no way in and I have to delete the server.

LutherSmi

Posted 2019-10-22T19:13:58.270

Reputation: 3

Answers

1

If you have physical access to the server you might be able to boot into Recovery Mode and from there undo your error. If it's a cloud server (like on scaleway or digitalocean) you should be able to find a similar options for booting a recovery or rescue kernel.

In recovery/rescue mode you are dropped into a root shell and can manually (re)mount your filesystems and do changes as admin user.

micke

Posted 2019-10-22T19:13:58.270

Reputation: 3 001

Its on AWS, So I can detach the root volume, attach it another new server, mount it to /mnt/ comment the chroot configuration, umount it, detach it and then attach it back to the original server. I should be able to ssh into the server now, remove the user ubuntu from sftpgroup and then uncomment the chroot config back and It should work as before. – LutherSmi – 2019-10-22T19:37:17.673

Its a lot of steps but at least the server is recoverable. – LutherSmi – 2019-10-22T19:38:13.523

I believe there is no 'recovery' mode in AWS but the above method should work. Thank you – LutherSmi – 2019-10-22T19:39:52.013

Correct no such thing on AWS but your described method should work and be just as quick. Good luck. – micke – 2019-10-22T19:43:21.743