cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
231061
Views
97
Helpful
12
Replies

SCP Copy

William Coats
Level 1
Level 1

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

12 Replies 12

johnd2310
Level 8
Level 8

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
Level 1
Level 1

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!

sheathj
Level 1
Level 1

Morning, I had a similar issue, the difference being I wanted to copy a common IOS from one Cisco device to another. I did not have a linux or windows SCP server running in the network, so just used one device to serve the file to the other.

Thought I would share my findings here as it may be useful.

A, and B devices were 4300 series ISR. 

issue 'ip scp server enable' on both A, and B.

A has the file already in bootflash:

B has sufficient memory in bootflash: to receive the file, aaa new model, and ssh all configured.

from A: issue, copy bootflash:/<filename> scp://<username@ipaddressB>//bootflash:/<filename>

For me the key was the '/' after the bootflash: for both source and destination paths.

I guess with scp you could pull the file as well? I have not tried that yet.

Hopefully that is useful.

Regards,

Jason.

CalastoneIT
Level 1
Level 1

Good old cisco, still the same error in 2023. Nearly 8 years after the initial post was made, I was bitten by the same bug when copying in 9.14 on a FTD 1150 in ASA mode !

it drops the initial slash from the filespec constructed from the source uri, causing the scp to fail. Doubling the initial slash after the host/ip in the uri fixes it, as does manually adding the slash when you override the incorrectly constructed source filespec

They really couldn't organise a nun-shoot in a nunnery ! Aren't we being punished enough by using firepowers in the first place ??

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:

Review Cisco Networking products for a $25 gift card