Error in execute process task while uploading a file to sftp server using PSFTP.exe - file-upload

I created a execute process task in SSIS to upload a file to a sftp server. I have full access to the server folder and was able to drag and drop files using filezilla. I am using putty sftp client psftp.exe to do the upload. Now when I use the psftp.exe with user and pass and batch arguments, it works perfectly fine in windows cmd. But when I execute the same in SSIS, I get the following error:
Error: 0xC0029151 at Execute Process Task, Execute Process Task: In Executing "C:\temp\psftp.exe" "user -pw pass -be -batch -b Upload.bat" at "C:\temp", The process exit code was "1" while the expected was "0".
Task failed: Execute Process Task
My windows cmd arguments are :
psftp.exe devsftp#secftp2.alliedpilots.org -b UploadUsersToSftp.bat
and then it asks for password and after entering password, file upload is done successfully. But I am having trouble performing same through SSIS. Below is the SSIS process task argument screenshot:
I searched online and found some similar questions at here but nothing specific to psftp. Also found same question on stackoverflow here but the solution mentioned is permissions, which I already checked.
Any help would be appreciated.

The SSIS most probably runs under a different local account than the one you use in "Windows cmd".
An SFTP access requires confirmation of a host key. You have probably verified the host key in your local account in the past, so it is cached in Windows registry.
But the account that runs SSIS does not have the host key cached. So it must fail.
You should add -hostkey switch to psftp.exe command line with the fingerprint of the expected host key.
If that does not help, wrap the psftp.exe to a batch file and redirect its output to a file.
psftp.exe devsftp#secftp2.alliedpilots.org -b UploadUsersToSftp.bat > c:\temp\psftp.out 2>&1
And run the batch file in SSIS, instead of psftp.exe directly.
Then check the file for errors.

Related

SSH login error - "libintl.so.9" not found

I'm logging in to vSphere VM (FreeBSD) using SSH and getting the following error-
Shared object "libintl.so.9" not found, required by "bash"
Connection to xxx closed.
I mistakenly changed root user's shell to bash. I was able to login earlier using csh. I can't run chsh or any other commands because I am not able to login to the server.
Is there a way to revert the shell change or specify shell while SSH login? I have tried rebooting the VM using vSphere but still getting the same error.
I have also tried sftp using FileZilla but since it uses SSH, I am getting the following error-
Status: Connected to xxx
Error: FATAL ERROR: Received unexpected end-of-file from SFTP server
Error: Could not connect to server
To fix this, you will need to shutdown the VM from vsphere, reboot, then choose "Single User" mode. Once at the single user shell, change root's shell to /bin/sh or /bin/csh. Don't use 3rd part shells for root.
Also, you get the error because your bash binary is out of date and not ABI compatible with the OS it's installed. Using pkg update should help once you get access again.

GPG Encryption failing in SSMS Job agent and successful in SSIS

I have a encryption job set, it executes just fine in Visual studio but give the following error in SSMS job agent-->
Error retrieving emailid#domain.com via WKD:No data gpg
skipped: No Data
Using SQL 2017. I tried using CMDEXEC instead of SSIS Package in job settings but it doesn't solve the problem
Arguments:
--quiet --yes --trust-model always --passphrase mypassphrase --recipient XXX#XXX.com --trust-model always --output D:\Folder\File.csv.gpg --encrypt D:\Folder\file.csv
So I was executing job from the proxy account and apparently proxy and own account is different when it comes to gpg key import. Meaning- I had imported keys using gpg/Kleopatra in my desktop using my windows credentials and was calling the job with my proxy account from job agent. Hence the proxy account was not able to access the keys. This is what solved my problem- https://superuser.com/questions/1176705/windows-account-cant-see-gpg-key#new-answer

I am trying to ssh to a windows machine from ansible, the program gets stuck

tasks:
name: Connect to Windows hpst machine through an ssh script
script : windows_connect.ssh
name: Run the bat file
script : C:\OV\sentenv.bat
name: To exit from the remote machine
shell: exit
This is what my playbook looks like.
Windows_connect.sh contains a script to connect to a windows machine via ssh.
ssh root#host
So ideally shouldnt ansible prompt me for a password?
Instead it gets stuck.
Please help me with the same
Ansible opens at least one new ssh connection for every task in the play.
So the idea to open a ssh connection with the first task and then reuse the connection in the later tasks will not work. Actually Ansible won't be able to execute the first task because the script module you are trying to use will already need a working connection to the remote host.
I have found little information on how many ssh connection Ansible will use to execute a task so I might be wrong here.
You should consult the Ansible documentation for Window support and implement a solution based on the winrm Python module.

How to input password on command prompt using VBA?

I've created a procedure on VBA (Excel) that restarts services on remote servers calling the command prompt and executing the "runas" command. I need to enter the command on the servers as administrator. So far it works fine but I don't want to have to type my password for each I want to run the command in. I know how I can automate the task using VBA and the Excel. What I don't know is how could I input my password on the command prompt using VBA?
Can anybody help me?
Thanks.
I've had all sorts of issues trying to convince runas to let me specify passwords from a program.
In the end, I tossed it and downloaded psexec from the Microsoft Windows Sysinternals site, which has other good stuff as well.
While many see this as a tool running remote programs, it can also be used quite happily to run local stuff under a different user name while allowing you to specify the password as a command-line argument, such as:
psexec -d -u USER -p PWD -w WORKDIR EXECUTABLE
You should be able to create a textbox control in VBA with the input mask set to password, this will allow you to enter the password in a non-viewable fashion.
Then you can just construct the psexec command and execute it from VBA, without having to worry about injecting the password into the process running runas.

How to run as different user without prompting user batch

I have a batch file that runs another batch file as a different user.
I also need to run the calling batch file remotely. Locally I can bypass having to enter the password with the /savecred option but then when I run the batch remotley, I still get prompted for the password but it would appear the connection times out because I'm brought back to the powershell prompt on the machine i'm connecting from.
my batch looks like this:
runas.exe /env /savecred /user:sqlsvr_dba ".\myBatch.bat"
How can I run the remote batch on my local machine without having to enter the password? I've been trying to use powershell for this.
Same question bothered me too :-)
I've tried to workaround this with schtasks and eventcreate.Here i posted my solution :
http://ss64.org/viewtopic.php?id=1539
If you want to run the script on a remote machine you can also try with wmic:
http://ss64.org/viewtopic.php?id=1495
Hope these will help you.