1

I have a file called test1.zip in /mnt/c/Users/test/ folder of my local laptop [in which ubuntu windows subsystem for linux is installed]. Local ubuntu terminal WSL name is lauda

Now, I would like to transfer this zip file called test1.zip to my remote server named stuff.

PLEASE NOTE THAT ALL COMMANDS ARE TRIED FROM MY LOCAL LAPTOP WSL SCREEN [ubuntu screen]

So, I tried the below command from my WSL [local laptop ubuntu WSL terminal]

scp user1@lauda:/mnt/c/Users/test/test1.zip user1@stuff:/home/test/codes/test1

and got the error ssh: Could not resolve hostname lauda: Name or service not known

So I tried the below [replacing the lauda local laptop ubuntu terminal hostname with its IP]

scp [email protected]:/mnt/c/Users/test/test1.zip user1@stuff:/home/test/codes/test1

this resulted in error as ssh: connect to host 172.xx.xxx.xxx port 22: Connection refused

Now I tried the same command as above but in opposite way as shown below

scp user1@stuff:/home/test/codes/ user1@lauda:/mnt/c/Users/test/test1.zip

and got the below error

ssh: Could not resolve hostname lauda: Temporary failure in name resolution

Later, I tried with IP address

 scp user1@stuff:/home/test/codes/ [email protected]:/mnt/c/Users/test/test1.zip

And I got the below error

ssh: connect to host 172.xx.xxx.xxx port 22: No route to host lost connection

Later, I tried the below commands as well

scp /mnt/c/Users/test/test1.zip user1@stuff:/home/test/codes/

and got an error scp: /home/test/codes/test1.zip: Permission denied

So, I again tried like below

scp user1@stuff:/home/test/codes/ /mnt/c/Users/test/test1.zip

and got an error scp: /home/test/codes: not a regular file

PLEASE NOTE THAT ALL COMMANDS ARE TRIED FROM MY LOCAL LAPTOP WSL SCREEN [ubuntu screen]

How can I transfer local files/folders from my local ubuntu WSL terminal to remote server?

1 Answer 1

2

I would check your permissions on the .zip file. You need at least read access to transfer the file. I would also confirm you can connect the server through SSH before transferring the file

# Navigate to the directory
cd /mnt/c/Users/test/

# Review the file permissions for test1.zip
ls -l

# Change permissions to read access for the user
chmod 400 test1.zip

# Transfer to remote server (After confirming you can log in via SSH)
scp ./test1.zip user1@stuff:/home/test/codes/
1
  • thanks for the response. Upvoted
    – The Great
    Commented Oct 17, 2021 at 13:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .