Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PuTTY PSCP error "Local to local copy not supported" when username contains a slash

Tags:

ssh

putty

pscp

I am trying to move a file from my local Windows machine to a remote Linux server using PSCP. I am connected to the VPN so that I can access my remote Linux machine with my username and password.

My PSCP command for transfer is:

pscp C:\Users\username\Desktop\list.txt PEM\[email protected]:/home/local/PEM/username

This result in the error

Local to local copy not supported


I have tried this command just for a trial

pscp C:\Users\username\Desktop\list.txt [email protected]:/home/local/PEM/username

The above command resulted in asking me the password. However, when I type in the password, the access is denied. This is because my remote Linux machine username is PEM/username and not username. However if I use PEM/username the "Local to local copy not supported" error message is coming. Does it have something to do with the slash \ in the username PEM\username?

like image 739
j1897 Avatar asked Dec 02 '15 07:12

j1897


People also ask

What is Pscp in PuTTY?

PSCP, the PuTTY Secure Copy client, is a tool for transferring files securely between computers using an SSH connection. If you have an SSH-2 server, you might prefer PSFTP (see chapter 6) for interactive use.

How do I copy a directory from Windows to Linux using PuTTY?

Just use pscp -r folder\to\copy user@server:/path/to/copy/folder/to . Note that the backslash after the original folder's name needs to be omitted. If you add a backslash, the content of the folder is copied, rather than the folder itself.

How do I transfer files using Pscp?

To copy a file or files using PSCP, open a command window and change to the directory in which you saved pscp.exe. Then type pscp, followed by the path that identifies the files to copy and the target directory, as in this example. Press Enter, then follow your usual authentication procedures to execute the transfer.

How do I copy a file from Windows to Linux using Pscp?

To transfer data from Windows, use an SSH client like PuTTY. This needs the PSCP (secure copy client) tool downloading to your Windows system to run alongside PuTTY. Find both on the PuTTY homepage. You'll be prompted for your password for the Linux computer before the transfer commences.


1 Answers

Yes, it's the backslash.

To workaround it, use an -l switch to specify the username.

pscp -l PEM\username C:\Users\username\Desktop\list.txt 10.120.43.78:/home/local/PEM/username

Background:

The PSCP looks for the first colon, slash or backslash in the target. Only if the first symbol is colon, it considers the target as remote, otherwise as local.

/*
 *  Find a colon in str and return a pointer to the colon.
 *  This is used to separate hostname from filename.
 */
static char *colon(char *str)
{
    /* We ignore a leading colon, since the hostname cannot be
       empty. We also ignore a colon as second character because
       of filenames like f:myfile.txt. */
    if (str[0] == '\0' || str[0] == ':' ||
        (str[0] != '[' && str[1] == ':'))
    return (NULL);
    str += host_strcspn(str, ":/\\");
    if (*str == ':')
    return (str);
    else
    return (NULL);
}

...

if (colon(argv[argc - 1]) != NULL)
    toremote(argc, argv);
else
    tolocal(argc, argv);
like image 116
Martin Prikryl Avatar answered Sep 17 '22 17:09

Martin Prikryl