sshportal icon indicating copy to clipboard operation
sshportal copied to clipboard

add user directly with public key instead of invite?

Open nictuku opened this issue 5 years ago • 2 comments

sshportal is amazing and the invite-based flow for adding users is pretty awesome!

But in some cases the information I have from the target user is their username and public key (because they already login to a normal SSH server that I own), and I'd like to make the process transparent for them so they login to sshportal as if it was the existing server.

Is there a way currently to add a user based on their public key (other than editing the database or backup config, of course)?

Here's a command that would work well for me, I think:

user create nictuku --key='ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEoD6YVJWufZaFCd41WEdeBsENMJWnwibs6SE87R/7qPb0cZFoEvoTsxwX5qGW/DTr4uYJUjlxFgM2GRUrcceAeFVSDEEqa7OU5tM5ABRE9jAS99V3D1kgj9RTcDhBI7y/lE8e0qSgfICZteJTvbcxHZltiBdrlrz8hDexL44rAez6s3/76SPK6OeIGzRJUmJ/PJMRS3nsFXj1WJD6sdMKkdpEJVrAMXg/GESwx4V66BMt2ZMoFvdmSgxts+f6CLSGkBhHzuty4sXhazVXvpnR5ha9zj8qyBHTvyalJJKxRAxx/PkHX82TiK0YWvTotKNaMKF+/SC7aVEki3wLP7wz'

Would that make sense? Let me know if you'd accept a PR to add this. Or perhaps you could suggest a better way for me to support my use case?

Many thanks!

nictuku avatar Aug 03 '18 07:08 nictuku

And this would also nice: userkey create --name=mykey user create nictuku --userkey=mykey and user create nictuku --key=' ...' Because sftp clients like filezilla on windows cant use invite. Or a better way to provide login for sftp clients?

Thanks :)

cchris-org avatar Aug 03 '18 07:08 cchris-org

ssh admin@portal user invite bob echo "ssh-rsa XXXXXXXXXxxxx..." | ssh admin@portal userkey create bob

It is still invite a new user, but assign key directly. There is a bug on userkey create. This PR is for it. https://github.com/moul/sshportal/pull/111

shawn111 avatar Dec 14 '18 12:12 shawn111