My local host computer is Ubuntu Desktop 16.

I am using libvirt KVM and Vagrant to create virtual machines.

I have a master machine that is considered as a web server as well (sudo apt-get install apache2).

I want multiple users to access the webpage (entering the master's ip address in their browser) and download a public key to authenticate their access to the master.

However, I am simulating this scenario in my local host, meaning that I open my browser in my local host and open the master's webpage and I click a button that downloads a public key for me to access the master.

Different public keys should be generated for each user. Also I want the public key or the session to be valid for a certain time until the user is done with his work.

So how can I achieve that? Is there a better solution for my scenario considering the local environment I'm working with? Should I generate multiple private/public keys or only one private key and multiple public keys? How can multiple access sessions be achieved on one master?

Please help me I'm confused and I am a very basic beginner in Linux so if anyone can provide me with the exact commands that would be very helpful.



Public-private keys are pairs, you cannot generate multiple public keys for one private key. So you'll have to generate one pair for each user.

As for the expiration time, this has been answered here. The solution uses ssh-agent, but you can also create a cron job that removes keys from the server every X minutes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.