I am usnig the below command to sftp a file from local serer to remote server using port number. Also, sftp key setup is done between those two servers. So, the pubilc key authentication should happen when ftp'ing the file to the remote server. But, i am not able to do so. But, i am able to ftp the file in command line. Can anyone help me on this.

Computing shared secret key. Verifying server signature. Waiting for NEWKEYS message. Send NEWKEYS. Enabling encryption/MAC/compression. Sending request for user-authentication service. Service accepted: ssh-userauth. Trying empty user-authentication request. Authentication methods that can continue: publickey,gssapi-with-mic,password. Next method to try is publickey. Next method to try is password. Trying password authentication. Will not query passphrase in batch mode. Authentication methods that can continue: publickey,gssapi-with-mic,password. Next method to try is publickey. Next method to try is password. Trying password authentication. Will not query passphrase in batch mode. Authentication methods that can continue: publickey,gssapi-with-mic,password. Next method to try is publickey. Next method to try is password. Trying password authentication. Will not query passphrase in batch mode. Authentication methods that can continue: publickey,gssapi-with-mic,password. Next method to try is publickey. Next method to try is password.

Permission denied at /data/pp42d1/software/perl-5.8.8/lib/5.8.8/Net/SFTP.pm line 62