4

I am trying Arch Linux for learning more stuff faster and not having GUI that bothers me, so that I can focus on learning stuff from Linux itself and the terminal. Since I was working with the default root@host I decided to create a new user. After creting the new user with a password and a dedicated user folder I rebooted and then neither the password for the root nor the newly created user worked... Maybe I did it wrong and don't understand how accounts work.

I used the following line to create the user in Arch.

useradd me -Umr -b /home -d /home/me -p newpass

Did I do something wrong or something? It seems i'm not able to login now from neither accounts.

My intention was to create a default user account that is not /root so that I am not always logged in as root user, so that when I boot up, the newly creted account pass is asked.

  • 1
    What happens when you try to log in? What error do you get? Is it the same error? What was password? Was it the actual password or did you encrypt it first? – terdon Sep 21 '17 at 13:34
  • As Ned64 has pointed out, -p is normally for adding encrypted passwords as seen in /etc/shadow, This shouldn't effect the root user though. – Raman Sailopal Sep 21 '17 at 13:35
4

The -p parameter to useradd expects an encrypted password. It would be bad security practice to give a password in a command line. This is because every process on the system can read all command lines (except when using containers). So, the useradd command will not accept a plaintext password but force you to encrypt it before giving it as a parameter.

Set the password interactively afterwards:

passwd me
  • Just tested it - ArchLinux requires a password while Ubuntu will ask interactively – msrd0 Sep 21 '17 at 13:39
  • 1
    @Lorthas -p does not encrypt the password but you need to pass an encrypted password! So, you do not say useradd ... -p mypass but something like useradd ... -p $6$/idugaTo$pdm..... – Ned64 Sep 21 '17 at 13:44
  • @msrd0 ah, OK. I deleted your comment since I tested (also on Arch) and saw that it expects a password and since the OP is using Arch, I figured it would only be confusing to leave the comment. – terdon Sep 21 '17 at 13:52
  • 1
    @terdon Why remove useful comments where people look for a solution? I don't get it. – Ned64 Sep 21 '17 at 17:12
  • 1
    @ned64 because the comment was suggesting that -p with no argument would prompt you. Apparently, it does so on Ubuntu, but not in Arch so the comment was misleading. Also, I admit I didn't know it was true for Ubuntu. I just tested, saw that it didn't work and deleted the comment. – terdon Sep 21 '17 at 22:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.