LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-20-2011, 01:35 AM   #1
shik28
LQ Newbie
 
Registered: Sep 2011
Location: India
Posts: 25

Rep: Reputation: Disabled
Question scp on the file stored in /


I am logged into a remote system as shik28. I have to retrieve a file which is located in the directory /log from the remote system to the local system.

when I write execute the following command,
Code:
scp shik28@somedomain.com:/log/source.txt destination.txt
I get an error,
Code:
/log/source.txt: No such file or directory
How do I do scp of files in /?
 
Old 09-20-2011, 01:42 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

You mention being logged into the remote server and want to scp a file to your local server. If that is true, the command is wrong (it scp's from remote to local):

Code:
scp /log/source.txt user@localserver.com:/path/to/destination.txt
The command posted by you would probably work if you executed it from the local server.

Hope this helps.
 
Old 09-20-2011, 01:49 AM   #3
shik28
LQ Newbie
 
Registered: Sep 2011
Location: India
Posts: 25

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by druuna View Post
Hi,

You mention being logged into the remote server and want to scp a file to your local server. If that is true, the command is wrong (it scp's from remote to local):

Code:
scp /log/source.txt user@localserver.com:/path/to/destination.txt
The command posted by you would probably work if you executed it from the local server.

Hope this helps.
@druuna: I tried this. I am getting the same error. Does scp have permission to retrive files from /root when I am logged in as user?
 
Old 09-20-2011, 02:07 AM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Nope. Usually a user hasn't got permission to access log files, but the error in that case would be "Permission denied". Check the path of the file: might it be in /var/log/ instead?
 
Old 09-20-2011, 02:09 AM   #5
shik28
LQ Newbie
 
Registered: Sep 2011
Location: India
Posts: 25

Original Poster
Rep: Reputation: Disabled
Unhappy

Quote:
Originally Posted by colucix View Post
Nope. Usually a user hasn't got permission to access log files, but the error in that case would be "Permission denied". Check the path of the file: might it be in /var/log/ instead?
@colucix: The path is absolutely correct.
 
Old 09-20-2011, 02:12 AM   #6
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

As already mentioned by colucix: You do need the proper permissions, on both sides. But the error shown points to a source that doesn't exist.

Hope this helps.
 
Old 09-20-2011, 02:15 AM   #7
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

What is the output of the following command:

On the local and the remote server: ls -l /log/source.txt (and please specify which is which).
 
Old 09-20-2011, 02:20 AM   #8
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
After reading through this thread, it seems the OP maybe confused now - As stated in the first post, he was logged into the remote system, trying to scp a file over to his local system. I think you want to not be logged in, and just use scp from the local computer, using the command posted in the first post, to remotely retrieve the file to avoid confusion.
 
Old 09-20-2011, 02:25 AM   #9
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
@corp769: As stated in post #2
 
Old 09-20-2011, 02:28 AM   #10
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
Originally Posted by druuna View Post
@corp769: As stated in post #2
Ahh, now I see it. I wanted to ask the same question you did before, but you beat me to it. This definitely sounds very simple
 
Old 09-20-2011, 02:29 AM   #11
shik28
LQ Newbie
 
Registered: Sep 2011
Location: India
Posts: 25

Original Poster
Rep: Reputation: Disabled
Command works fine now. Thanks for all your replies.
 
Old 09-20-2011, 02:30 AM   #12
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
Originally Posted by shik28 View Post
Command works fine now. Thanks for all your replies.
What was your fix for the minor issue? And how did you send the file/files over? From your local computer, sending the scp command over?
 
Old 09-20-2011, 02:39 AM   #13
shik28
LQ Newbie
 
Registered: Sep 2011
Location: India
Posts: 25

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by corp769 View Post
What was your fix for the minor issue? And how did you send the file/files over? From your local computer, sending the scp command over?
The issue has been solved for some files in /log i.e. text files. But I get the same error when I try to retrieve other files which have no extension (like: I have a file called df.last with no extension displayed).

I tried to get the file type using the following command
Code:
file /log/df.last
It says:
Code:
/log/df.last: ASCII text
So now the problem lies in getting the extension for this file. So finally my problem is partially solved. Sorry for marking the thread as [SOLVED].
 
Old 09-20-2011, 02:46 AM   #14
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
It's not really clear how did you solve the previous problem: please, can you post the command you used to copy the file /log/source.txt? The same command would work for any other file, despite the absence of extensions. What is the error message in this case?

Furthermore, it's not clear what is your concept of file extension, since df.last has the "last" extension (even if this concept in linux is quite arbitrary).
 
Old 09-20-2011, 03:53 AM   #15
shik28
LQ Newbie
 
Registered: Sep 2011
Location: India
Posts: 25

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by colucix View Post
It's not really clear how did you solve the previous problem: please, can you post the command you used to copy the file /log/source.txt?
Code:
scp shik28@domain1.com:/log/source.txt destination.txt
This works fine.

Quote:
Originally Posted by colucix View Post
The same command would work for any other file, despite the absence of extensions. What is the error message in this case?
No, it is not working for one file by name df.last. Error msg is
Code:
/log/df.last: No such file or directory
Quote:
Originally Posted by colucix View Post
Furthermore, it's not clear what is your concept of file extension, since df.last has the "last" extension (even if this concept in linux is quite arbitrary).
The file name itself is df.last. I don't know the extension. last is not an extension. It is a part of the filename.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
scp to invoke files stored in environment variable shik28 Linux - Newbie 10 09-16-2011 03:41 AM
scp truncate text file busy - copying file is not a running binary jetberrocal Linux - Server 3 06-24-2010 03:56 PM
what file(s) are hotkeys stored in? newbiesforever Linux - General 8 09-09-2008 02:04 PM
what file are routes stored in? hcclnoodles Solaris / OpenSolaris 6 10-04-2006 02:46 PM
How to file stored in C:\ using windows abbhatt Linux - Software 3 12-26-2005 10:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration