AIX

AIX

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


#Power
#Power
 View Only
  • 1.  sftp file into the target system with encrypted password

    Posted Fri November 30, 2012 02:01 PM

    Originally posted by: SystemAdmin


    We are praparing a script to move a file from AIX 6.1 to other system.

    we are using the below script"put_etransfer.ksh"

    #!/usr/bin/ksh
    sftpdate=`date +"%Y%m%d%H%M"`
    filename=hsa-selectacc.asc
    logfile=/home/data/interfaces/log/etransfer_$sftpdate.log
    cd /home/data/usinterfaces/out
    if ! -e $FILENAME
    then
    print "ERROR - $FILENAME does not exist."
    print "Exitting ..."
    exit 1
    fi
    /usr/local/bin/sftp -B /home/hrdata/scripts/USsftp/cmdc.sftp qaz00100@move.etransfer.com >> $logfile


    here cmdc.sftp conatains below commands
    binary
    ls -l
    put hsa-selectacc.asc
    exit
    ==========================================================
    when we execute put_etransfer.ksh we get error message

    ./put_esecuretransfer.ksh
    Error: Could not open connection to `qaz00100@move.etransfer.com': Could not connect to `move.etransfer.com': Disconnected by application
    when I change the script to
    #!/usr/bin/ksh
    sftpdate=`date +"%Y%m%d%H%M"`
    FILENAME=hsa-selectacc.asc
    logfile=/home/hrdata/usinterfaces/log/etransfer_$sftpdate.log
    cd /home/hrdata/usinterfaces/out
    if ! -e $FILENAME
    then
    print "ERROR - $FILENAME does not exist."
    print "Exitting ..."
    exit 1
    fi
    sftp qaz00100@move.etransfer.com

    and execute the script put_etransfer.ksh
    It will ask for password and if I provide the password it will get connected but i need to give the command put hsa-selectacc.asc

    Can any one help me on this.

    Thanks inadvance
    Viswanath
    #AIX-Forum


  • 2.  Re: sftp file into the target system with encrypted password

    Posted Fri November 30, 2012 02:28 PM

    Originally posted by: unixgrl


    If I understand what you are trying to do I think you need to either:
    a) have ssh keys between the two systems that will allow password-less transfer
    b) put the password in the command file "passwd <yourpasswordhere>"

    There may be another way to pass in the password like we used to with .netrc files but it would be dependent on the sftp you are using and whether your company allows you to do that.
    #AIX-Forum


  • 3.  Re: sftp file into the target system with encrypted password

    Posted Sat December 01, 2012 03:39 AM

    Originally posted by: SystemAdmin


    Hi Sir,

    I am not allowed to give password in the command line.In this case I need to encrypt the password.

    how can I encrypt the password.

    Thanks,
    Viswanath
    #AIX-Forum


  • 4.  Re: sftp file into the target system with encrypted password

    Posted Sat December 01, 2012 08:38 AM

    Originally posted by: SystemAdmin


    Hi,

    updated the script with below line
    export password=abcdxy123

    still it pormpts for password

    Thanks,
    Viswanath
    #AIX-Forum


  • 5.  Re: sftp file into the target system with encrypted password

    Posted Sat December 01, 2012 09:33 AM

    Originally posted by: SystemAdmin


    Putting the password into a file isn't much more secure that not using it when sending the command.

    As already suggested, have you checked out using ssh/scp? Setting up passwordless keys would be more secure and easier to do.
    #AIX-Forum