# 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.

<p class="callout info">NOTE: Replace 'username' with the target user.</p>

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

```bash
sudo mkdir -p /home/username/.ssh
```

Set correct permissions for the .ssh folder:

```bash
sudo chmod 700 /home/username/.ssh
```

Create the authorized\_keys file:

```bash
sudo touch /home/username/.ssh/authorized_keys
```

Set permissions on authorized\_keys file:

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

Set ownership of the .ssh folder to the user:

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

Now, you can add keys to the authorized\_keys file as needed, for remote SSH authentication.

#### Scripted Creation

The above commands can be quickly performed with this bash script:

```
#!/bin/bash
USERNAME="deploy"

sudo mkdir -p /home/$USERNAME/.ssh
sudo touch /home/$USERNAME/.ssh/authorized_keys
sudo chmod 700 /home/$USERNAME/.ssh
sudo chmod 600 /home/$USERNAME/.ssh/authorized_keys
sudo chown -R $USERNAME:$USERNAME /home/$USERNAME/.ssh
```