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?
CodePudding user response:
scp /mnt/c/Users/test/test1.zip user1@stuff:/home/test/codes/
is the closest attempt to working. The error you get could be due to one of two reasons:
Firstly user1
does not have permissions to write to /home/test
on stuff
- makes sense as usually only the test
user would be able to write there. (Note that the test
user on your WSL instance is not the same profile the test
user on the remote.)
Secondly the /home/test/codes/
folder may not even exist yet.
Instead (if you know test
's password) copy as the test
user :
scp /mnt/c/Users/test/test1.zip test@stuff:/home/test/codes/
Or copy to user1
's home directory (after ensuring you have created /home/user1/codes/
scp /mnt/c/Users/test/test1.zip user1@stuff:/home/user1/codes/