How can I create a new user then SSH into the box under that user?
I ran:
useradd marco -d /home/marco -p WuUfhRdt4B
Then I added to /etc/ssh/sshd_config:
AllowUsers root marco
Then restarted ssh:
/etc/init.d/ssh restart
I can't login. What did I miss?
** Running Debian.
The first thing I see is that you didn't specifically add a shell, you can ensure that the users shell is correct by running as root:
The other thing to ensure is that the home directory was created by the useradd script.
If it was not created you'll need to create it and change the ownership to the correct user:
I would also make sure that your password was correctly placed in /etc/shadow as I never trust it from the command line:
And enter the password for marco (BTW, it's a really really bad idea to put a password anywhere but in a password field that is not shown. History files are extremely easy to read, as is serverfault :) Make sure you change marcos password is all I'm saying)
If you still can't login check /var/log/auth, /var/log/messages, /var/log/secure etc for sshd entries, it should give you a pretty good idea as to what is failing.
In your example, is WuUfhRdt4B meant to be the user's password? That won't work because the argument to useradd -p is (according to the man page) "the encrypted password, as returned by crypt(3)." You probably want to use adduser anyway, since it's a lot more intuitive than useradd. Try this:
adduser marco