Results 1 to 6 of 6
  1. #1
    Join Date
    May 2004

    Unanswered: Secure Shell FTP (SFTP?)

    Hi all,

    We are new using Secure Shell to connect to our AIX boxes. Currently FTP is till enabled but in the near future it will be disabled and all FTP transcactions must be done via SFTP (Secure FTP). Does anyone know how this works from the command line? I tried the same format as FTP (ie sftp <boxname>) but it doesn't work.

    Last edited by everpro; 07-01-04 at 15:40. Reason: typos

  2. #2
    Join Date
    Sep 2003
    If you server is configured for SSH then you need to create KEYS (public and private) for each machine between which FTP is required.
    do man ssh-keygen

    for additional details, see


  3. #3
    Join Date
    May 2004

    Thanks for the info.... have created the keys but (r/o)

    I run the sftp command in a script is appears to run without error but the actual file is not ftp'd.... any ideas what would be causing that?

    Thanks in advance!!

  4. #4
    Join Date
    Sep 2003
    try changing permisssion 755 for your home directory at remote machine.

    If not then try running ftp from command prompt instead from script and post the results

  5. #5
    Join Date
    May 2004
    Barcelona, Spain
    try including -v option to sftp.
    this should write to standard output information on connection, authentication or configuration issues.

    hope this helps

  6. #6
    Join Date
    May 2004

    Got it to work but but not exaltly how I'd like it to run... another ?

    First thanks for the tips! I verified the permissions on the target directory are set appropriately. I started from scratch and have gotten it to work, however, I had to create two separate files to make this work. Ie. contains:

    sftp -B up.txt

    up.txt contains:

    open psadmin@psbhvt2b
    cd sshtest
    put mj.txt

    Is there any way of getting this to run using only one script? Everytime I try to run the following it does not work:

    /apps/ssh2/bin/sftp2 psadmin@psbhvt2b << marker
    cd /home/psadmin
    put mj

    Here is the verbose output:

    SshFileCopy/sshfilecopy.c:673: Making local connection.
    SshFileXferClient/sshfilexferc.c:1317: ext_name `', data:
    00000000: 0a .
    SshFileCopy/sshfilecopy.c:616: Connection to local, ready to serve requests.
    Sftp2/sftp2.c:412: Connection ready.
    SshReadLine/sshreadline.c:2420: Initializing ReadLine...
    SshFileCopy/sshfilecopy.c:687: Connecting to remote host. (host = psadmin@psbhvt2b, user = NULL, port = NULL)
    Sftp2/sftp2.c:3364: Couldn't find ssh2 on path specified (/usr/local/bin/ssh2). Trying default PATH...
    argv[0] = ssh2
    argv[1] = -v
    argv[2] = -x
    argv[3] = -a
    argv[4] = -opasswordprompt=%U@%H's password:
    argv[5] = -oauthenticationnotify=yes
    argv[6] = psadmin@psbhvt2b
    argv[7] = -s
    argv[8] = sftp
    SshSigChld/sigchld.c:238: Registering handler for pid 59104.
    SshSigChld/sigchld.c:238: Registering handler for pid 59104.
    debug: SshConfig/sshconfig.c:3072: Metaconfig parsing stopped at line 3.
    debug: SshConfig/sshconfig.c:3364: Read 3 params from config file.
    debug: Ssh2/ssh2.c:1751: Found user config file '/home/psadmin/.ssh2/ssh2_config'
    debug: SshConfig/sshconfig.c:3364: Read 1 params from config file.
    debug: Connecting to psbhvt2b, port 22... (SOCKS not used)
    debug: Ssh2Transport/trcommon.c:3748: My version: SSH-1.99-3.2.9 F-SECURE SSH 3.2.3
    debug: client supports 2 auth methods: 'publickey,password'
    debug: Ssh2Common/sshcommon.c:588: local ip =, local port = 34599
    debug: Ssh2Common/sshcommon.c:590: remote ip =, remote port = 22
    debug: SshConnection/sshconn.c:1945: Wrapping...
    debug: Ssh2/ssh2.c:1002: Opening /dev/tty for queries.
    debug: SshReadLine/sshreadline.c:2420: Initializing ReadLine...
    debug: Remote version: SSH-2.0-3.2.9 F-SECURE SSH 3.2.3
    debug: Major: 3 Minor: 2 Revision: 9
    debug: Ssh2Transport/trcommon.c:1377: lang s to c: `', lang c to s: `'
    debug: Ssh2Transport/trcommon.c:1443: c_to_s: cipher aes128-cbc, mac hmac-sha1, compression none
    debug: Ssh2Transport/trcommon.c:1446: s_to_c: cipher aes128-cbc, mac hmac-sha1, compression none
    debug: Remote host key found from database.
    debug: Ssh2Common/sshcommon.c:380: Received SSH_CROSS_STARTUP packet from connection protocol.
    debug: Ssh2Common/sshcommon.c:430: Received SSH_CROSS_ALGORITHMS packet from connection protocol.
    N O T I C E - P R O P R I E T A R Y S Y S T E M

    This system is intended to be used solely by authorized
    users in the course of legitimate corporate business.
    Users are monitored to the extent necessary to properly
    administer the system, to identify unauthorized users
    or users operating beyond their proper authority, and
    to investigate improper access or use. By accessing
    this system, you are consenting to this monitoring.

    debug: server offers auth methods 'publickey,password'.
    debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1794: Starting pubkey auth...
    debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1751: Agent is not running.
    debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1549: Got 0 keys from the agent.
    debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1666: adding keyfile "/home/psadmin/.ssh2/id_dsa_2048_a" to candidates
    debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1529: Trying 1 key candidates.
    debug: Constructing and sending signature in publickey authentication.
    debug: Ssh2AuthPubKeyClient/authc-pubkey.c:836: reading private key /home/psadmin/.ssh2/id_dsa_2048_a
    debug: Ssh2AuthPubKeyClient/authc-pubkey.c:1890: Public key authentication was successful.
    debug: Ssh2Common/sshcommon.c:340: Received SSH_CROSS_AUTHENTICATED packet from connection protocol.
    debug: SshReadLine/sshreadline.c:2478: Uninitializing ReadLine...
    debug: Ssh2/ssh2.c:765: Returning user input stream to original values.
    debug: Ssh2Common/sshcommon.c:915: num_channels now 1
    Sftp2/sftp2.c:3295: buffer: 'AUTHENTICATED YES
    debug: SshTtyFlags/sshttyflags.c:354: Not a tty. (fd = 0)
    debug: Ssh2ChannelSession/sshchsession.c:3161: Requesting subsystem sftp
    SshFileXferClient/sshfilexferc.c:1317: ext_name `', data:
    00000000: 0a .
    SshFileCopy/sshfilecopy.c:616: Connection to remote host 'psadmin@psbhvt2b', ready to serve requests.
    SshReadLine/sshreadline.c:2478: Uninitializing ReadLine...
    debug: SshConnection/sshconn.c:406: EOF from channel stream
    debug: Ssh2ChannelSession/sshchsession.c:2249: received exit status : 0
    psadmin@psfsta ==> debug: Ssh2Common/sshcommon.c:881: num_channels now 0
    debug: Got session close with exit_status=0
    debug: Ssh2Common/sshcommon.c:713: Destroying SshCommon object.
    debug: SshConnection/sshconn.c:1997: Destroying SshConn object.

    The error I hightlighted in red above does not appear be causing the problem since I am using the same ssh/sftp command in the first set of scripts.

    Any help would be greatly appreciated!!!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts