I would like to add new user without needed any interaction, so with specified password. I have tried command above:
useradd -m -p user -s /bin/bash user
So it should be a
user with password
user, but I can't login via SSH.
man page. The argument to
-p is not the plaintext password:
-p, --password PASSWORD
The encrypted password, as returned by crypt(3). The default is to disable the password.
and it would be an extremely dangerous command if it were. There is no easy way to do what you want, because what you want is dangerous.
Edit: I understand that you feel your circumstances justify this loss of security, and you might be right: but there is no way for the
passwd command to know what you're thinking.
If you're sure you don't mind this loss of security, you could do
echo fr00zalgn3t | passwd --stdin user
to set the initial password to the echoed string, but if you do this, you should also do
chage -d 0 user
immediately after, to require that the password be changed on first login. You should also ensure that your shell history is cleared after doing this, so the passwords used aren't sitting in a permanent record on-disc. And you should not, ever, use the username as an initial password, no matter how low-end you feel the system is.