7

I want to copy a file from my local system to a remote host. I want to specify the file name while copying.

This is my command for copying.

scp config/1 root@remote:/home/user/config/2

I want to rename the file while copying or with the same name like this.

scp config/1 root@remote:/home/user/config/1

But I dont want to use like the below command.

scp config/1 root@remote:/home/user/config/

When I specify the filename i get the error: Not a directory

Muneeb K
  • 457
  • 1
  • 9
  • 21

3 Answers3

4

This is a known bug in openssh, unfortunately not fixed, even though there is a patch for that.

In short, it means that the file does not exists, but the scp is confused by the trailing slash.

Jakuje
  • 24,773
  • 12
  • 69
  • 75
1

You need to run the scp command from the local machine, not on the remote. You don't need the ssh at all:

user@local $ scp -P 2222 file.ext username@domain:~/ 
Dipnesh Parakhiya
  • 516
  • 1
  • 5
  • 17
0

I got error "Not a directory" when tried scp with "-p" instead of "-P" for remote port number. Check your syntaxis.

user2285323
  • 119
  • 1
  • 11