scp command problem - forward slashes vs back slashes

Core FTP Server questions and answers
Post Reply
jlin
Posts: 4
Joined: Wed Jan 08, 2014 11:07 pm

scp command problem - forward slashes vs back slashes

Post by jlin »

Hi,

I have installed a Core FTP Server for testing but I noticed a problem when running SCP command on a HP-UX server to copy files.

Without going into the detail of my Core FTP setup, I will just list the scp commands that worked vs the one that did not work.

All SCP commands are executed on a HP-UX 11.23 server.

Example 1: Copy file from HP-UX to Windows running Core FTP server

scp /tmp/mytestfile.txt sftpuser@remote_windows_server:/test/mytestfile.txt

This one worked okay.

Example 2: Copy file from Windows running Core FTP Server to HP-UX

scp sftpuser@remote_windows_server:/test/mytestfile.txt /tmp/mytestfile.txt

This command failed.
I would get the following error message:

error: unexpected filename: /test/mytestfile.txt

The error message is also recorded in a Core FTP Server log file so that means the error was generated by Core FTP Server.

Example 3: Copy file from Windows running Core FTP Server to HP-UX but use back slashes when specifying pathname on remote Windows server:

scp sftpuser@remote_windows_server:"\test\mytestfile.txt" /tmp/mytestfile.txt

This scp command worked.

Here are my questions:

1) Can anyone explain why the scp command in example 2 failed?

The command basically does the reverse of the scp command in Example 1 which used only forward slashes for both local and remote file pathnames.

2) Is there anyway to force Core FTP Server to accept forward slashes in file pathnames when it receives a scp request from another server?

Any information would be appreciated.
Thank you.
jlin
Posts: 4
Joined: Wed Jan 08, 2014 11:07 pm

Re: scp command problem - forward slashes vs back slashes

Post by jlin »

I noticed another problem when using SCP command to send file from a Unix server to Core FTP Server.

The following command is able to send a file with spaces in its file name from one Unix server to another Unix server and retain the same file name that has space characters in it:

scp "/tmp/My Test File.txt" "sftpuser@remote_server:/My\\ Test\\ File.txt"

But if I try to use the same command to send a file from Unix server to Core FTP Server, I would get the following error:

"The filename, directory name, or volume label syntax is incorrect".

So it seems that Core FTP Server does not escape special characters received from SCP command the same way Unix systems do.
ForumAdmin
Site Admin
Posts: 987
Joined: Mon Mar 24, 2003 4:37 am

Post by ForumAdmin »

Use Unix format for remote files, Windows format for local files.
jlin
Posts: 4
Joined: Wed Jan 08, 2014 11:07 pm

Post by jlin »

[quote="ForumAdmin"]Use Unix format for remote files, Windows format for local files.[/quote]

Using Windows format still does not escape spaces in file names or directory names and using the SCP command.

IMO, I think Core FTP Server should auto translate Unix style pathnames for SCP command because that is pretty much the norm. And if I need generate some SCP commands dynamically to transfer file between different servers, I would not need to keep track of which target server is Unix or Windows.

For now, I am going to avoid using SCP command to send files to Core FTP server. Hopefully the SCP function will be improved in the future.

Thank you.
Post Reply