13

I have Ubuntu Server 14.04 LTS. I have Public key authentication enabled by default.

I used the following command to create new user:

sudo useradd -m -c "John T." john -s /bin/bash

The command apparently created user, user's home folder... but obviously user cannot log in, because user does not have a key. What's next? How to create key and attach it to the user?

-c -- User's full name
-m -- Creates user's home directory
-s -- Specify user's login shell
Maris B.
  • 453
  • 2
  • 7
  • 17

1 Answers1

11

You need to store his public key in ~john/.ssh/authorized_keys as described in manual page for sshd (good place to start). Also you need to make sure the ~john/.ssh/ directory is owned by john and has 0700 permissions and ~john/.ssh/authorized_keys also with permissions 0600.

Then the user should be able to log in.

Jakuje
  • 6,793