Description

In some cases, it may be necessary to copy a file from Junos VM to a host OS for troubleshooting purposes.

This article details the steps to do the same.

 

Solution

To copy a file from Junos VM to a host OS, perform the following steps:

  1. Log in as root .
labroot@qfx5100> start shell user root
  1. Locate the file that you want to copy:

root@qfx5100:RE:0% ls -l /var/tmp
total 896
drwxrwxr-x  2 root     wheel     512 Jan 14 20:00 .snap
-rw-r--r--  1 labroot  wheel  414703 Mar  8 19:29 file.tgz <<< file we want to copy
drwxr-xr-x  2 root     field     512 Jan 15 18:06 gres-tp
drwxrwxrwx  2 root     wheel     512 Jan 15 18:06 install
<...>
  1. Enter the host shell ( root account is needed).

root@qfx5100:RE:0% cli
{master:0}

labroot@qfx5100> request app-engine host-shell
--- Host 14.1X53-D46.7 built 2017-11-24 16:34:04 UTC
  1. Copy the file from Junos VM. Use a username that is present on Junos OS and has sufficient permissions.

-sh-4.1# scp [email protected]:/var/tmp/file.tgz /var/tmp/file.tgz   <<< copying file using existing user account in Junos (labroot)
The authenticity of host '192.168.1.2 (192.168.1.2)' can't be established.
RSA key fingerprint is 42:a5:5b:13:c2:d1:07:e6:ed:9d:ee:16:48:85:b7:4e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.2' (RSA) to the list of known hosts.
Password:
file.tgz                                      100%  405KB 405.0KB/s   00:00
  1. Verify that the file was copied successfully:

-sh-4.1# ls -l /var/tmp
total 408
-rw-r--r-- 1 root root 414703 Mar  8 20:02 file.tgz