问题
I have an interesting dilemma with PuTTY PSFTP.
Set up...
Pageant .60
putty .60
Used command:
D:\psftp.exe -load myserver.domain.us.com -l User1 -b MyCommand Script
This loads PuTTY PSFTP, logs in using the user ID with the help of Pageant and then sends a file using commands in the script.
This works great while logged in as an Admin on the server. It fails while logged in as a regular user on the server:
"psftp: no hostname specified;"blah blah blah.
Including -v
reveals no further messages.
What possible delta could there be with permissions or other settings between a server Admin and regular user when it comes to PuTTY?
回答1:
You load PuTTY stored site myserver.domain.us.com
.
That is stored in Windows registry of the local account.
If you run the script using a different account, it won't see the site definition.
You have to define the session completely on command line. What you probably even attempted.
- Remove the
-load
; - Add
-ssh
to make it clear you want to use SSH (but it's default anyway) - Add
-hostkey=...
with a fingerprint of the SSH host key (you need the latest version of PuTTY for the-hostkey
switch, but you need to upgrade anyway, the version 0.60 is not secure).
D:\psftp.exe -ssh myserver.domain.us.com -hostkey=... -l User1 -b MyCommand Script
来源:https://stackoverflow.com/questions/42141404/putty-psftp-command-line-works-as-admin-fails-as-user