AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
  • 1.  passwd 3004-709 Error changing password for "test"

    Posted Fri March 07, 2014 04:58 AM

    Originally posted by: fengheshang


    Hi,

    I execute "ssh test@192.168.1.15 passwd" on one Linux server('192.168.1.5' is the ip of an AIX server).The execute result is :

    [root@ulpm ~]# ssh test@192.168.1.15 passwd

    test@192.168.1.15's password:

    Changing password for "test"

    3004-709 Error changing password for "test".

    [root@ulpm ~]#

     

     

    The AIX server uses the factory configuration.I can use "passwd" to change password in the AIX server.

    Please help!

     



  • 2.  Re: passwd 3004-709 Error changing password for "test"

    Posted Fri March 07, 2014 10:11 AM

    Originally posted by: Wouter Liefting


    The passwd tool is not a tool that simply reads stdin. For security reasons, passwd closes file descriptor 0, and then opens it again so that it is connected to a tty. That's why you can't do stuff like

    $ (echo bla; echo bla) | passwd

    or

    # (echo bla; echo bla) | passwd test

    on any UNIX operating system. (It also doesn't work on Linux, although on Red Hat you can do echo bla | passwd --stdin test)

    I would imagine the issue you're having with running passwd directly as an ssh command will have the same cause.

    If you have root access via ssh to the AIX box, then chpasswd is your friend. I have not tested it, but something along the lines of this should work:

    echo test:bla | ssh root@192.168.1.15 chpasswd

    Also check out the -c and -f option to chpasswd - they may be required for what you want to do.

    If you don't have root access but you do have access to a user account that's member of the security group, you may also be able to do something with pwdadm.



  • 3.  Re: passwd 3004-709 Error changing password for "test"

    Posted Sat March 08, 2014 02:13 AM

    Originally posted by: fengheshang


    I don't have root access and don't have access to a user account that's member of the security group.So I cant't use chpasswd or pwdadm to do something.The user "test" is only a normal user.You can test the ssh command before on an AIX server with root logined  to change the passwd of the normal user "test".

     

    Thanks also.



  • 4.  Re: passwd 3004-709 Error changing password for "test"

    Posted Tue March 11, 2014 10:02 AM

    Originally posted by: Wouter Liefting


    Do you have "expect" available on the Linux client? There are several examples out on the net which allow you to use expect in combination with ssh to run the passwd tool remotely, and to let expect provide you with the proper responses.

    The following script runs on my Linux machine (CentOS 6.4 with expect and ssh), and resets the password of the specified user account on the remote AIX system (AIX 7.1):

    #!/usr/bin/expect -f
    # wrapper to make passwd(1) be non-interactive
    # username is passed as 1st arg, passwd as 2nd
     
    set username [lindex $argv 0]
    set password [lindex $argv 1]
    set serverid [lindex $argv 2]
    set newpassword [lindex $argv 3]
     
    spawn ssh $username@$serverid
    expect "assword:"
    send "$password\r"
    expect "\$ "
    send "passwd\r"
    expect "Old password:"
    send "$password\r"
    expect "New password:"
    send "$newpassword\r"
    expect "new password again:"
    send "$newpassword\r"
    expect eof
     

    You call this script with ./scriptname <username> <oldpw> <servername> <newpw>.

    Note that expect is only required on the Linux client, not on the AIX server. The AIX system is standard, but with SSH installed - although if you fiddle the script you can also use it with telnet. (To install expect on a Red Hat or RH-derived system, use yum install expect.)