Fail to create password in Ubuntu with STAF

Help
Dick
2012-11-05
2013-06-12
  • Dick

    Dick - 2012-11-05

    staf local process start shell command "echo -e \"password\npassword\" | sudo passwd username" returnstdout stderrtostdout wait

    error:
    Data       : Enter new UNIX password: Retype new UNIX password: Sorry, passwords do not match
    passwd: Authentication token manipulation error
    passwd: password unchanged

     
  • Sharon Lucas

    Sharon Lucas - 2012-11-05

    From the error message, it would appear that the passwords do not match which makes me think that maybe the the -e option for echo is not working correctly to enable interpretation of backslash escapes, like if you specified the following it doesn't recognize \n as a newline character:

    # echo -e password\npassword
    passwordnpassword

    Try specifying a single quote instead of specifying \" around password\npassword.

    # echo -e 'password\npassword'
    password
    password

    For example, the following works fine on my Linux system (note I didn't use sudo because I don't have it set up and I was running STAFProc as root):

    # staf local process start shell command "echo -e 'test1staf\ntest1staf' | passwd test" returnstdout stderrtostdout wait
    Response


    {
      Return Code: 0
      Key        : <None>
      Files      : [
        {
          Return Code: 0
          Data       : New UNIX password: Retype new UNIX password: Changing password for user test.
    passwd: all authentication tokens updated successfully.

        }
      ]
    }

     
  • Dick

    Dick - 2012-11-08

    Hi slucas,

    Thanks for the reply.  I still get the same error message even using your same command above.  I tried single and double quotes, both failed.  I suspect it might be the version of STAF, I am using 3.49, and I will try using the latest 3.4.11.

     
  • Dick

    Dick - 2012-11-08

    Still failed with STAF 3.4.11

    $ staf local process start shell command "echo -e 'test1staf\ntest1staf' | passwd test" returnstdout stderrtostdout wait
    Response


    {
      Return Code: 10
      Key        : <None>
      Files      : [
        {
          Return Code: 0
          Data       : Enter new UNIX password: Retype new UNIX password: Sorry, passwords do not match
    passwd: Authentication token manipulation error
    passwd: password unchanged

        }
      ]
    }

     
  • Sharon Lucas

    Sharon Lucas - 2012-11-08

    Did you try running the command from a terminal on your Linux system (without using STAF) to make sure it is working?

    $ echo -e 'test1staf\ntest1staf' | passwd test

     
  • Dick

    Dick - 2012-11-08

    Yes, this works, but NOT using STAF, :(

     
  • Dick

    Dick - 2012-11-08

    It works, without -e

    staf local process start shell command "echo 'test1staf\ntest1staf' | passwd test" returnstdout stderrtostdout wait

     

Log in to post a comment.