cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
174060
Views
90
Helpful
10
Replies

SCP Copy

William Coats
Beginner
Beginner

I am having trouble getting scp to work in my network.  They have set up a Ubuntu server as the file server and set it to use our Windows Active Directory credentials to log in.  I moved the IOS images to the data folder of the server and tried to copy a new IOS to my switch.  I used the following command to do the copy:

copy scp://username@10.x.x.x/data/cat3k_caa-universalk9.SPA.03.07.01.E.152-3.E1.bin flash:

 

I keep getting an error of "No such file or directory".

 

I then moved the file to my folder on the server, /home/local/Company/username, and changed the command to this:

copy scp://username@10.x.x.x/cat3k_caa-universalk9.SPA.03.07.01.E.152-3.E1.bin flash:

 

This works.  I don't want to have each person on the network team to have a copy of each IOS on the server.  I only want the current version we are using and in a folder that everyone can use.  How do I change the first command so it can change to the correct folder to find the file?

1 Accepted Solution

Accepted Solutions

The copy was from a Linux (RHEL 6) host also. All the users home directories are under /home with the images, configs etc., in /app/tftpboot. Here's an ls from my home directory using the absolute path from root to a file called poap.py in that directory.

[sfuller@rhel601 ~]$ ls -l /app/tftpboot/poap.py
-rw-r--r--. 1 nfsnobody nfsnobody 20048 May 27 16:05 /app/tftpboot/poap.py
[sfuller@rhel601 ~]$


And here's the copy, first with the single slash and so failing, and secondly with a double slash and succeeding.

c3750-1#copy scp://sfuller@192.168.11.100/app/tftpboot/poap.py flash:
Destination filename [poap.py]?

Password:

%Error opening scp://sfuller@192.168.11.100/app/tftpboot/poap.py (No such file or directory)
c3750-1#
c3750-1#copy scp://sfuller@192.168.11.100//app/tftpboot/poap.py flash:
Destination filename [poap.py]?

Password:
!
20048 bytes copied in 3.892 secs (5151 bytes/sec)

 

As long as you include the absolute path with a double slash it does seem to work.

Regards

View solution in original post

10 Replies 10

johnd2310
Collaborator
Collaborator

HI,

 

You need to specify the full path to the data folder. Is the data folder a sub-directory of another folder? You also need to ensure you have permissions to the data folder.

 

Thanks

John

**Please rate posts you find helpful**

Hi,

 

When I login, I am in the following folder /home/local/Company/username.  I don't know how to tell the switch to move up to the /data folder.

 

I do have permissions to the /data folder as I already moved all of the IOS images to that folder.

 

Thanks,

William

William Coats
Beginner
Beginner

I figured out how to correct the problem I was having.  I created a symbolic link between my folder and the folder where the files need to be located.  That allows me to moved around in my home directory to the correct folder.

I'd noticed this in the past and found adding a double slash after the hostname/IP address can work. For example:

c3750-1#copy scp://usernam@192.168.11.100//home/username/x flash:
Destination filename [x]?

Password:
!
170 bytes copied in 2.374 secs (72 bytes/sec)

This doesn't really follow the SCP URI scheme (https://tools.ietf.org/html/draft-ietf-secsh-scp-sftp-ssh-uri-04) or any documentation that I've found, but seems to work.

Regards 

The problem is we don't want each administrator to have their own folder with data in it.  We want all of the data to be in a folder located off of the root drive.  When I move the file to my home folder, this is a Linux machine, I was able to download the file.

 

I had to create a symbolic link to where the data needs to be stored.  The I could use the link to get to the correct folder and the file I was trying to copy to the switch.

The copy was from a Linux (RHEL 6) host also. All the users home directories are under /home with the images, configs etc., in /app/tftpboot. Here's an ls from my home directory using the absolute path from root to a file called poap.py in that directory.

[sfuller@rhel601 ~]$ ls -l /app/tftpboot/poap.py
-rw-r--r--. 1 nfsnobody nfsnobody 20048 May 27 16:05 /app/tftpboot/poap.py
[sfuller@rhel601 ~]$


And here's the copy, first with the single slash and so failing, and secondly with a double slash and succeeding.

c3750-1#copy scp://sfuller@192.168.11.100/app/tftpboot/poap.py flash:
Destination filename [poap.py]?

Password:

%Error opening scp://sfuller@192.168.11.100/app/tftpboot/poap.py (No such file or directory)
c3750-1#
c3750-1#copy scp://sfuller@192.168.11.100//app/tftpboot/poap.py flash:
Destination filename [poap.py]?

Password:
!
20048 bytes copied in 3.892 secs (5151 bytes/sec)

 

As long as you include the absolute path with a double slash it does seem to work.

Regards

Double slash worked for me too, thank you so much!!!

 

asa5545-test# copy /noconfirm scp://user:password@10.10.10.10/localdisk/ftp/asdm-7101.bin disk0:/asdm-7101.bin

Accessing scp://user:password@10.10.10.10/localdisk/ftp/asdm-7101.bin...
%Error reading scp://user:password@10.10.10.10/localdisk/ftp/asdm-7101.bin (Resource temporarily unavailable)

 

asa5545-test# copy /noconfirm scp://user:password@10.10.10.10//localdisk/ftp/asdm-7101.bin disk0:/asdm-7101.bin

Accessing scp://user:password@10.10.10.10//localdisk/ftp/asdm-7101.bin...!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Double slash works great. 

Thanks Steve Fuller

I ended up on this post while trying to find the solution. The instructions were helpful.

while logged into cisco switch, I successfully pulled file from Linux scp server to its bootflash: with out using double slash for the file path (the first set of double slash // are still required)

copy scp://

 

 

[user26@linuxserver2 ~]$ pwd
/srv/home/user26

 

 

[user26@linuxserver2 ~]$ ls -a /srv/home/user26/textfile.txt
/srv/home/user26/textfile.txt

 

 

 

WS-C4500X-32-switch#copy scp://user26@192.168.12.59/textfile.txt bootflash:
Destination filename [textfile.txt]?
Password:
Sending file modes: C0664 19 textfile.txt
!
19 bytes copied in 6.808 secs (3 bytes/sec)

 

in case if the command with // does not work on specific cisco ios then command with / can be used.

 

In another situation while logged into linuxserver uploaded a file to WS-C2960-24PC-L switch

where scp15 is a privilige 15 level user on switch with ip 192.168.13.14 ( WS-C2960-24PC-L)

[user26@linuxserver2 ~]$ scp test-file.txt scp15@192.168.13.14:test-file.txt
Password:
test-file.txt 100% 19 9.4KB/s 00:00

and while logged into linuxserver downloaded a file from the switch

[user26@linuxserver2 ~]$ scp scp15@192.168.13.14:test-file.txt new-test-file.txt
Password:
test-file.txt                                                                                          100%   19     5.3KB/s   00:00

If scp on Linux box throws error "Administratively disabled." while trying to uploading to or downloading from cisco switch, that indicates scp is not enabled. Do so on Cisco switch using commands

conf t

ip scp server enable

exit

 

And then try again.

 

Thanks

Thank you Steve Fuller! This was exactly what I was looking for. Use of the double slash did the trick for me to allow me to get to the proper file path!
Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers