1

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.

user36651
  • 23
  • 3

2 Answers2

5

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

More specifically:

passwd newuser

Warner
  • 23,440
  • 2
  • 57
  • 69
  • how can i set a default password using adduser? – user36651 Mar 03 '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 03 '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 03 '10 at 20:34
4

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>
Scott Pack
  • 14,717
  • 10
  • 51
  • 83
  • I have visions of typeracer.. +1 for good answer. – Warner Mar 03 '10 at 20:31
  • how can i set a default password using adduser? – user36651 Mar 03 '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 04 '10 at 03:14