0

I have this command in a setup script

Running Command: useradd ftpsecure
Running Command: /etc/init.d/vsftpd restart
Running Command: chkconfig --add vsftpd
Running Command: chkconfig vsftpd on
Running Command: /usr/sbin/groupadd cdms-users
Running Command: /usr/sbin/useradd -g cdms-users -d /ftpUploads/ cdmsUser -p cdms
        [ESC[0;31mFAILEDESC[0m]

Seem to be running into problems with the last command. If anyone had any idea what could possibly be wrong.

Thanks in advance guys.

wkl
  • 77,184
  • 16
  • 165
  • 176
unleashed
  • 1
  • 1
  • 1
    The `-p` parameter of `useradd` is used to pass the encripted password. Maybe `cdms` is not a valid password. – ThoriumBR Apr 13 '11 at 20:09

1 Answers1

0

useradd's -p flag (for specifying a password) is not for specifying a plaintext password.

This is the description from useradd's manpage.

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

       Note: This option is not recommended because the password (or encrypted password) will
       be visible by users listing the processes.

       You should make sure the password respects the system's password policy.

You would have to generate the crypt hash for the password.

The accepted answer in this other StackOverflow thread shows a way to do it: Useradd using crypt password generation

Though specifying the plain password on the command line could be a security vulnerability, as it could be recorded in command line history.

Community
  • 1
  • 1
wkl
  • 77,184
  • 16
  • 165
  • 176