Transferring remote files via ssh,find,cpio locally
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My issue that I am having is that cpio is not on the webserver and I dont have the permission to install it. So I assumed that I can just use cpio locally to do my dirty work.
I can see that the find stuff is not getting piped to my cpio locally and I get no such file errors:
Code:
cpio: /var/www/vhosts/mywebsite.com/httpdocs/data/customer/log/kwesthuba.log: Cannot stat: No such file or directory
cpio: /var/www/vhosts/mywebsite/httpdocs/data/customer/log/chaz.key: Cannot stat: No such file or directory
cpio: /var/www/vhosts/mywebsite/httpdocs/data/customer/log/mob786.key: Cannot stat: No such file or directory
What am I missing??
Last edited by metallica1973; 11-20-2011 at 07:54 PM.
The problem is that the cpio is running on the local machine, not the remote one, so it is looking on the local machines for the files (and not finding them).
Is tar a possibility instead of cpio?
If not, you might have to copy the files over to the local machine before archiving them (perhaps using rsync over ssh or something similar).
Incidentally, you could probably run your own copy of cpio on the remote machine in your own home folder; you don't have to install it in a system directory and it doesn't have many dependencies.
Last edited by neonsignal; 11-21-2011 at 03:03 AM.
cpio: /var/www/vhosts/mywebsite.com/httpdocs/data/customer/log/kwesthuba.log: Cannot stat: No such file or directory
cpio: /var/www/vhosts/mywebsite/httpdocs/data/customer/log/chaz.key: Cannot stat: No such file or directory
cpio: /var/www/vhosts/mywebsite/httpdocs/data/customer/log/mob786.key: Cannot stat: No such file or directory
So its appears to be "cpio -oavc" which does not want to receive output via the webserver or locally. ???????
Last edited by metallica1973; 11-24-2011 at 11:47 PM.
You seem to be moving the quotes around on the command you are sending over ssh. If the close quote happens before the cpio, then cpio will be run locally, and will not be able to find the files. The close quote must occur after the cpio.
Last edited by neonsignal; 11-24-2011 at 11:25 PM.
That does work but like I said before, for some odd reason the exclude file is excluding everything. Here is the content of both the include and the exclude:
These denied folder are expect but as you can see the exclude file is excluding everything. There is nothing magical with my exclude file other then certain directories that I want to exclude. Both of the files have the same permissions:
Code:
-rw-r--r-- 1 testuser testuser 91 Nov 24 09:50 include
-rw-r--r-- 1 testuser testuser 224 Nov 24 09:55 exclude
cat include
/var/www/vhosts/mywebsite/cgi-bin
/var/www/vhosts/mywebsite/httpdocs
cat exclude
/var/www/vhosts/mywebsite/httpdocs/downloads/
/var/www/vhosts/mywebsite/httpdocs/data/caca/
/var/www/vhosts/mywebsite/httpdocs/data/tmp/
/var/www/vhosts/mywebsite/httpdocs/demo/
This works but I need to have the exclude do what I need it to do. This would work beautifully if I could somehow get my exclude file to work to eventually produce what I want:
I haven't testing it yet but if that is the case then I have to say, white spaces in files has caused me many headaches. I will test it out and let you know thanks.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.