How to add public SSH keys for users in Cockpit
Adding public SSH keys with Cockpit can easily be handled by a Cockpit admin.
Red Hat Enterprise Linux 8 and CentOS 8 both include the powerful admin tool Cockpit. With this tool, you can manage many aspects of the server. One such aspect is the addition of public SSH keys for users. By adding these keys, users are then able to make use of key authentication with their SSH logins to the server. Yes, you could do this from each client machine, using the ssh-copy-id command, but as an administrator, you don’t want to have to walk around the company and sit at each desktop to send those keys to the server.
Instead, you can simply add those keys from the Cockpit web-based interface. This means you must have copies of your users’ public keys, which you might already have. Depending on your security policy, you might even allow users to log into Cockpit (more on this in a bit).
But for those users who require logging in to that server via SSH, adding secure key authentication should be a priority. So let’s find out how to add those public keys via Cockpit.
SEE: 10 things companies are keeping in their own data centers (TechRepublic download)
How to locate the public key
For those that have yet to acquire copies, let me first show you how to locate those public keys. I’ll be demonstrating from Pop!_OS Linux, so if you’re using either a Windows or macOS machine, you’ll have to locate the necessary files based on your platform of choice. To copy the SSH public key for a user, open a terminal window and issue the command:
Where USERNAME is the name of the user in question. That command should display the user’s public SSH key (Figure A).
Copy that key for later pasting…