Possible Duplicate:
Adding new users

I'm trying to add a new user account to my ftp server.

I used

useradd -p password -d /home/newuser -s newuser

now when he tries to log in it accepts the UID and asks for a password, when i try to enter the password it says access denied.

I'm kinda new to the ADMIN side, I inherited a huge mess from the last guy and have been trying to sort out the whole mess.

it is an FTP server but should allow ssh access.

Any help is greatly appreciated.

link|improve this question
feedback

closed as exact duplicate by Chris S Feb 17 at 16:02

This question covers exactly the same ground as earlier questions on this topic; its answers may be merged with another identical question. See the FAQ for guidance on how to improve it.

2 Answers

up vote 4 down vote accepted

By the useradd man page:

   -p, --password PASSWORD
   The encrypted password, as returned by crypt(3). The default is to disable the account.

So, you set the hashed password to be that of the actual one. The easiest option at this point is to manually reset the password. As root:

passwd <username>
link|improve this answer
I have visions of typeracer.. +1 for good answer. – Warner Mar 3 '10 at 20:31
how can i set a default password using adduser? – user36651 Mar 3 '10 at 20:35
Setting a default password is a pretty bad practice, as it creates a known exploit path. I'm guessing this is a pretty small scale environment, so I would recommend either generating a scary password for each new user (using apg or similar), or having the users stop by so they can type in their initial password. – Scott Pack Mar 4 '10 at 3:14
feedback

-p expects the password hashed using crypt. Use the passwd command to set the password interactively.

More specifically:

passwd newuser

link|improve this answer
how can i set a default password using adduser? – user36651 Mar 3 '10 at 20:28
1  
I typically useradd and then passwd. Some distributions and UNIXes have scripts, such as in Linux's Slackware. I've known the script to be called adduser. If you don't have one, you can write your own. – Warner Mar 3 '10 at 20:31
If you really want to know how to generate password crypt, find a utility to do it for you or you can copy the password crypt for a password you know from /etc/shadow. Careful with escaping control characters such a $ when copy/pasting. – Warner Mar 3 '10 at 20:34
feedback

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