Introduction
In this article, we will discuss how to configure a groupable SSH server on a Local Ubuntu Server. The goal is to create an environment where multiple users can securely access the server using SSH keys. This setup is essential for system administrators managing multiple user accounts.
Prerequisites
Before we begin, ensure the following prerequisites are met:
- A fresh Ubuntu Server installation
- A basic understanding of the Linux command line
Step 1: Create a new user
To create a new user, use the following command:
sudo adduser
Replace
Step 2: Generate an SSH key pair for the new user
To generate an SSH key pair, use the following command:
su -
ssh-keygen -t rsa -b 4096 -C "[email protected]"
Press enter to accept the default file location and name.
Step 3: Copy the public key to the authorized_keys file
To copy the public key to the authorized_keys file, use the following command:
cat ~/.ssh/id_rsa.pub | pbcopy
echo "Host *
\IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config
ssh-copy-id -i ~/.ssh/id_rsa.pub :
Replace
Step 4: Allow passwordless login
To allow passwordless login, edit the /etc/ssh/sshd_config file:
sudo nano /etc/ssh/sshd_config
Add the following lines:
PubkeyAuthentication yes PasswordAuthentication no
Save and exit the file.
Step 5: Restart the SSH service
To restart the SSH service, use the following command:
sudo systemctl restart ssh
Step 6: Test the connection
To test the connection, use the following command:
ssh @
In this article, we discussed how to configure a groupable SSH server on a Local Ubuntu Server. We created a new user, generated an SSH key pair, copied the public key to the authorized_keys file, allowed passwordless login, and restarted the SSH service. By following these steps, we were able to create a secure environment where multiple users can access the server using SSH keys.