Skip to main content

Linux: Missing .SSH Folder

When creating a new linux user, the system may not create a .ssh folder in the user profile, by default.

This creates a little complexity as the permissions are a bit picky.

Here are steps to do so.

NOTE: Replace 'username' with the target user.

Create the .ssh folder in the user's profile:

sudo mkdir -p /home/username/.ssh

Set correct permissions for the .ssh folder:

sudo chmod 700 /home/username/.ssh

Create the authorized_keys file:

sudo nano /home/username/.ssh/authorized_keys

Set permissions on authorized_keys file:

sudo chmod 600 /home/username/.ssh/authorized_keys

Set ownership of the .ssh folder to the user:

sudo chown -R username:username /home/username/.ssh