Creating non-root user with ssh

May 14, 2017 664 views
Getting Started CentOS

Hey guys,

I just created a new droplet with ssh keys and what i want is to create a non-root user and login it using putty without using the root user.

Any suggestions on how to do it?

3 Answers

Hi @marianorovin
You login with your key as root and then create a new user with the command
adduser marianorovin
https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-a-centos-7-server

When you first start using a fresh Linux server, adding and removing users is one of the most basic tasks that you should know how to do. In this guide, we will cover how to create user accounts, assign `sudo` privileges, and delete users on a CentOS 7 server.
  • can i do this without using sudo?

  • Ohh, I think password login might have been disabled for SSH, so you need to edit the file /etc/ssh/sshd_config and find/add this line:

    PasswordAuthentication yes
    

    EDIT: And restart sshd - think it's /etc/init.d/sshd restart on CentOS.

    • i got error. "Disconnected: no supported authentication methods available. "
      Do i have to do anything else?

      • @marianorovin

        Which user are you trying to login with? Both root and the new user?

        Are you sure the parameter PasswordAuthentication isn't located multiple places in the file? Make sure it's only listed one time.

        • i was trying to login the user that i have created. and yes i only have one PasswordAuthentication

@marianorovin
I'm probably just tired, but just to make sure: Do you want the new users to be able to access the server with a password or do you want them to use a key like root?

Have another answer? Share your knowledge.