How do I copy files with pscp to a non-home folder?

5,167

Connect to the server using PuTTY or ssh, and use Windows whoami/all to check the privileges you have in an interactive SSH session.

Then check it again but do not open an interactive session this time; instead run ssh yourhost whoami /all or plink yourhost whoami /all, since batch and interactive sessions may get assigned different privileges. SCP uses the former.

Compare both outputs with the one you get when connecting over RDP interactively. It could be that Remote Desktop assigns more than freeSSHd – for example, it could be that the special INTERACTIVE group is not assigned when using SCP.

Share:
5,167

Related videos on Youtube

Blub
Author by

Blub

Updated on September 18, 2022

Comments

  • Blub
    Blub over 1 year

    Copying to the desktop and any other home folder works, but when I try to copy to a drive like C:\file.txt, it tells me "unable to open C:\file.txt: permission denied"

    I'm using freeSSHd on the windows server, and using NT authentication, so I'm logging in with the same user that I'm also logging in via remote desktop. When using remote desktop, I can(!) copy files to C:\ or D:\ simply with CtrlC / CtrlV.

    Why not with pscp?

    Desired commandline:

    pscp -v -pw MyPassword C:/file.txt MyUser@ServerIp:C:/file.txt
    

    Working commandline:

    pscp -v -pw MyPassword C:/file.txt MyUser@ServerIp:/Desktop/file.txt
    

    I already tried several variations with the slashes, forward, backward, double backward.. any advice on how to debug this issue?

  • Blub
    Blub almost 11 years
    All three outputs show the same privileges: SeImpersonatePrivilege, SeCreateGlobalPrivilege, SeChangeNotifyPrivilege. For the INTERACTIVE and REMOTE INTERACTIVE LOGON groups it says "Enabled group" on all 3 tries.