I'm new to Linux, so I may be a bit unfamiliar with the terminologies used here, but what I'm trying to do now is from a Windows PC, I would use plink to ssh into a Linux server and use sudo to run as another user to copy a file from a remote location to local. E.g.,
from a Windows machine A: plink [email protected] "sudo -u user_a python /tools/copyfile.py remoteserverC.com:/a/b/c/filetocopy.txt /local/targetfile.txt"
- where both linuxserverB and remoteserverC is Linux
- python script would accept 2 param argument and calls scp to copy, first is source and next is destination to copy
I would get Disconnected: Protocol error (Too many authentication failures for user_a). Child process (ssh) exited with code 78)
A few things I noticed:
If I use plink to do the same call but source and target changed to only copy files within
/localTo ‘/local/‘,(linuxserverB ) there will be no issues. It only happens if I try to access a file from remoteserverC.com like the original example.I tried using the same command as ssh instead of plink on another Linux machine (Linux D), and doing a verbose dump, I see that I would get almost the same error:
X11 connection uses different authentication protocol. X11 connection rejected because of wrong authentication. .. Unable to open display linuxserverB.com:123.0 Disconnected. Protocol error (Too many authentication failures for user_a)- So I thought it may be due to X11 forwarding issues, although I'm not too familiar with this concept. Basically I tried using
-Xon theplinkand would get:Putty X11 proxy: wrong authorisation protocol attemptedUnable to open display linuxserverB.com:123.0 ... Disconnected: Protocol error (Too many authentication failures for user_a) I tried using
xauthto add the displays on both remoteserverC.com and linuxserverB.com so that both remoteserverC.com and linuxserverB.com contains each other's display id but the problem still persists.I also tried installing XMing on the Windows machine A, and was able to do a plink of
xeyessuccessfully.
So I'm not too sure what is wrong. Is there any other thing that I can try? Is the issue due to X11 forwarding display location or due to .XAuthority issues?
plinkto ssh into B and then copy a file from C to B.” in your first paragraph.) … (Cont’d)sudo…”, but then you sayplink [email protected] "sudo …". (1c) What OS is “remoteserver.com” running? (1d) Oh, wait; what is “a Linux PC” and how does it fit in? … (Cont’d)ssh B,plink B, or using PuTTY? If so, try running your “copyfile” command from there, so it’s clearer what command causes what error. (2b) Why aren’t you usingscp? (3) Why are you talking about X11? For simply copying files, X shouldn’t be a factor. … … … … … … … … … … … … … … Please do not respond in comments; edit your question to make it clearer and more complete.sudo, then you'd need to enter a password right? Can you open an interactive ssh session, then run the command? Presumably that would give you a password prompt, which might be missing when you send the command directly?