sshportal
sshportal copied to clipboard
Reset admin user
What happened: I don't know how to reset admin user.
What you expected to happen: I do not have access to the admin ssh key so I need to reset the admin user, and I cannot find any information about how to do it.
Hi @Madeorsk, do you have "local" access to the server that hosts the sshportal binary?
What kind of database are you using: sqlite, mysql?
Hi, yes I do have a "local" access to the server. I think it is an sqlite database as I found a file named "sshportal.db" next to the logs in the sshportal directory but I could not open it:
Unable to open database "sshportal.db": file is encrypted or is not a database
I finally found another solution to my problem, but I think that it can happen to someone else and I still find interesting to know how I could have done.
Hi,
Yes I have the same issue. I would like to reset the admin ssh key. I'm using sqlite and I have also "local" access to the server.
After a copy of the data (sshportal.db and log files) on another storage backend I am unable to log as an admin.
I have the following error : error: unknown ssh key
(but my ssh key did not change).
All the other users do not have issues using the portal. Just me with the admin account.
Did you try with the sqlite
binary or the sqlite3
binary?
I often got confused with this error message when using the wrong one :)
I have been able to use another user account as admin by using litecli https://litecli.com/ and changing the is_admin value in the users table and the users_user_role mapping to set the admin role to my other user.
From there I have deleted the existing admin account and set my new account as admin.
I think the best procedure to do this though is :
Go in the database with litecli, find the ssh key associated with the admin user you want to reset by making a select in the users and user_keys table. Then delete the corresponding row in the user_keys table. You can then use the invite token in the users table for the user that has no key anymore and connect to the admin cli.
Did you try with the
sqlite
binary or thesqlite3
binary?
Ha, it was the reason why I could not access the database. I guess I would be able to change the admin user by using sqlite3 sshportal.db
instead of sqlite sshportal.db
.