fileserverscpopensshpscp

Transferring files from windows machine to the server using SSH client


I want to transfer my folder from my local windows machine to the remote server, but it says permission denied as I'm placing files at root directory, and it have all the permissions

First I place this command ssh root@IP then it says enter you password I entered my password and then I run this command scp -r d:\kbt root@IP:/var/www/html/ But then it ask for the password and then it says permission denied Please help me if anyone can.enter image description here


Solution

  • The issue here is starting the ssh session first. So when you are running scp it's executing on the destination machine. It's interpreting d:\test.txt in the same way it interprets 162.246.22.217:/var/www/html - It thinks the d bit before the colon is the machine name. You can see that because it asks for root@d's password

    What you need to do is:

    1. run it on the Windows machine, without first starting ssh
    2. Arrange it so you don't need to specify the drive letter D: because of how scp interprets that colon.

    Try this from your Windows command shell:

    pushd d:\
    scp -r \kbt root@IP:/var/www/html/
    

    The pushd puts the current working directory on the right Windows drive so you can just use the path from the root of that drive, without needing the colon.

    Once the scp command above has completed, you can use the ssh command to check that they're there where they should be.

    I'd be a bit concerned about 69 failed login attempts. Unless you know it was you.

    Edit: some older versions of Windows don't include scp - You can use pscp from Putty very similarly.