Create new user for ssh

  • Create new user

# useradd -m -s /bin/bash new_user

  •  Give root permission to new user

# vi /etc/sudoers.d/newuser

new_user ALL=(ALL) NOPASSWD:ALL

  • Option :

If you want to login password

# passwd new_user

If you want to login with key copy your public key to authorize_key

# su – new_user

# mkdir /home/new_user/.ssh

# vi /home/new_user/.ssh/authorized_keys

  • Paste your public key
  • change permission of file

# chmod 755 /home/new_user/.ssh

# chmod 600 /home/new_user/.sshauthorized_keys

Was this article helpful?

Related Articles