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

后端 未结 2 953
忘了有多久
忘了有多久 2021-02-20 08:33

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 user

相关标签:
2条回答
  • 2021-02-20 08:51

    i think you are missing apostrophe after Windows file path:

    pscp "C:\Users\username\Desktop\list.txt" PEM\username@10.120.43.78:/home/local/PEM/username
    
    0 讨论(0)
  • 2021-02-20 08:52

    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);
    
    0 讨论(0)
提交回复
热议问题