0

Here what I try to do; from my router ([email protected]). I want to SCP a file on my PC and copy it to my router.

So, if I'm already in ssh remote: root@openwrt: SCP root@mypc? What is my PC, home/username?

2 Answers 2

2

This won't work as your PC would need to have a SSH service running.

Do it the other way around: run a SCP program on your PC (e.g. WinSCP if your PC runs Windows OS, scp if it runs Linux, etc.), use it to connect via SSH to your router ([email protected]), and transfer the file. No need to know your PC's current user name and IP address.

3
  • I run Linux, so winscp is windows but anyway this part is a script's process. I want to include that into my script Commented Mar 7, 2022 at 16:14
  • I have modified my answer. Commented Mar 7, 2022 at 16:32
  • Yep ok, but my problem is the script is running on the router and at the end, I need to exit from router session to SCP from PC so. To exit from script and ssh router's session, what is the command ? Commented Mar 7, 2022 at 16:52
1

You can run the following commands on your linux PC.

To get current logged in username:

whoami

To get the IP address:

hostname -I
3
  • 1
    question is asking for username and most probably cannot scp from router using hostname 'mypc', so I suggested to find out ip address as well. Commented Mar 8, 2022 at 10:18
  • As I said, I'm using a script from my router Commented Mar 8, 2022 at 22:25
  • Those are username and ip address that you can use for your script on your router. From your router, you can run: scp <file-on-router> <pc-username>@<pc-ip-address>: Commented Mar 9, 2022 at 6:07

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.