LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SCP: No such file or directory...but its there!? (https://www.linuxquestions.org/questions/linux-newbie-8/scp-no-such-file-or-directory-but-its-there-283547/)

Baix 01-28-2005 09:29 PM

SCP: No such file or directory...but its there!?
 
I'm trying to get a friend to scp a file to me, test.txt, we've been using the command (yes...foo'd=my ip address):

scp test.txt brian@foo'd:/home/brian

however he keeps getting the error:

cp: brian@foo'dhome/brian: No such file or directory

Yes...for some reason in the error the :/ between the ip and /home/brian is not there. And I double checked...brian does have an account, password and a /home directory on my computer.

Dark_Helmet 01-28-2005 09:58 PM

Does the server actually have an apostrophe ( ' ) in the name, or is that just an example? If it does, that's probably part of the problem. The shell is probably interpreting that as the beginning of a string. Try escaping it:
Code:

scp test.txt brian@foo\\'d:/home/brian

Baix 01-28-2005 10:00 PM

no sorry, foo'd is just what i changed my ip address to show, and there's no apostrophe in the ip address. I'd rather not have people bashing on my door trying to log in as brian lol

Dark_Helmet 01-28-2005 10:04 PM

Your friend can ssh into the box using the brian account, right?

I mean:
Code:

ssh brian@ip_address
and he gets a shell to mess around with.

Baix 01-28-2005 10:15 PM

lol we should have tried that in the first place. Yes he can ssh right on in.

Dark_Helmet 01-28-2005 10:20 PM

Well, I don't understand what would be the problem. I'll ask this though:
Quote:

cp: brian@foo'dhome/brian: No such file or directory
I'm hoping the "cp" is a typo and it's actually scp ;) If your friend is using cp, then you need to bludgeon him about the face and neck.

If you can ssh in, then there should be no problem with scp... I'm at a complete loss...

Baix 01-28-2005 10:25 PM

Actually cp isn't a typo, the error actually comes out like that.
And I made quadrubly sure he was trying scp before preparing to bludgeon him to a bloody pulp. :D

Baix 01-28-2005 10:33 PM

Even wierder... he just sftp'd in and fetched a file.

Dark_Helmet 01-28-2005 10:33 PM

That's odd, because I went to go try it myself. Here's what I got:
Code:

$ scp test.txt helmet@spaceball1:/home/helmet/no_exist/test.txt
helmet@spaceball1's password:
scp: /home/helmet/no_exist/test.txt: No such file or directory

Very odd indeed, because if my version were acting like yours, then I would have expected to see:
Code:

scp: helmet@spaceball1home/helmet/no_exist/test.txt: No such file or directory
That suggests there's something kinda funky going on... maybe scp is not interpreting the destination path correctly. Are there any special characters being used on the command line, like double quotes, or the like? Something that might cause confusion?

And for the record, my version of scp:
Code:

$ ssh -V
OpenSSH_3.9p1, OpenSSL 0.9.7e 25 Oct 2004


Baix 01-28-2005 10:40 PM

i noticed you also had to type in a password, he doesn't even get to do that.

Also I tried to do exactly what i told him to do, even used his name and password and it worked:

Code:

bash-3.00$ touch test.txt
bash-3.00$ scp test.txt brian@foo'd:/home/brian
brian@foo'd's password:
test.txt                                    100%    0    0.0KB/s  00:00

and same version:
Code:

bash-3.00# ssh -V
OpenSSH_3.9p1, OpenSSL 0.9.7e 25 Oct 2004

Oh lol, he just reminded me...is now a bad time to mention that he's on a mac using its unix /bin/bash. Not sure if it matters though, seeing as he's able to ssh and sftp. His ssh -V says:
OpenSSH_3.6.1p1+CAN-2004-0175, SSH protocols 1.5/2.0, OpenSSL 0x0090702f

Dark_Helmet 01-28-2005 10:46 PM

At this point, I think it's pretty clear there's something fubar'ed with his client. I don't know if he's using a linux box with a strange/old version of the ssh suite, or if he's using a windows client that needs some reconfiguring, but there's something wrong on his side.

I'll look the other way if you want to start bludgeoning at this point.

EDIT: That could be the problem. Mac ports (I have heard) are not always 100% faithful reproductions of their original unix counterparts. I would check the man page for his scp documentation. He may need to break up his command. For instance, he may need to do something like:
Code:

scp -u brian -ra foo'd test.txt /home/brian
Again, just an example, it will probably be different. In other words, specifying the user name with a command line option, the server to connect to, etc.

Unfortunately, I don't have any first-hand experience with a Mac, and can't give anything more than that...

Baix 01-28-2005 10:49 PM

Looks like you caught it before me, just edited my last post when he reminded me about that. And not to be redundent but his ssh -V is:

Code:

OpenSSH_3.6.1p1+CAN-2004-0175, SSH protocols 1.5/2.0, OpenSSL 0x0090702f
and if he can ssh and sftp why won't scp work as well? Anyway, thanks a lot for your time and help.

EDIT: Oh just saw your other edit about the mac ports, we'll try that and check his man pages.

Dark_Helmet 01-28-2005 10:53 PM

Yeah, if he can ssh, then his version should be capable of handling the protocols to copy the file. Even doubly so if he can sftp (because an scp should be a trivial ftp connection). My guess is the command line syntax. I figure there's got to be something unique/different in the way he would have to specify the user name, server, and that sort of thing.

Baix 01-28-2005 11:12 PM

I'm getting a headache look at this mess lol:

Here's he's usage for scd:
Code:

usage: scp [-pqrvBC1246] [-F config] [-S program] [-P port]
          [-c cipher] [-i identity] [-l limit] [-o option]
          [[user@]host1:]file1 [...] [[user@]host2:]file2

And here's my usage for scd:
Code:

usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
          [-l limit] [-o ssh_option] [-P port] [-S program]
          [[user@]host1:]file1 [...] [[user@]host2:]file2

There are minor difference, working on trying to figure out how exactly the command should chnage.

Dark_Helmet 01-28-2005 11:18 PM

Well, it looks pretty much the same... I was mainly suspicious of the user@host parts.

In that case, the problem might be with bash and how it interprets the command line. He could try quoting the destination file in an attempt to preserve it. Something like:
Code:

scp test.txt 'brian@ip_address:/home/brian'
I didn't use the foo'd bit just to avoid confusion about the quoting. If that works, then his version of bash is interpreting the user@host:file specification as something "special".


All times are GMT -5. The time now is 04:44 AM.