Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
michaelk: Yes, I did enable sftp/ssh via the control panel in the NAS. I'm not following you on the rest about the .ssh keys. Right now, I am trying to rync as root, which works for some directories and not others as illustrated in my last post. However, I do anticipate that I will need to address the issue that you brought up about .ssh keys and will have to figure out how to automate this process by ssh-copy-id, later.
This interfaces with the rsync daemon if I'm not mistaken, rather than going through ssh. So your arguments are conflicting and likely the rsync daemon doesn't have permission to write to /system/MachineName/stage/datafolder. If you want to go through ssh, you should only have one colon.
Also, where exactly are you trying to dump these files? ~/backups/system/MachineName/stage or /backups/system/MachineName/stage or /system/MachineName/stage or what?
I found one of the problems with respect to the Time Stamp pertaining to the -a argument for Rsync:
rather than
>rsync -rav ....
I use
>rsync -rv ...
then it don't get the time stamp problem, and the Rsync works. Why did it work on the testfolder with -rav and not with the datafolder?
I even tried chmod 775 and 777 on the datafolder directory and it didn't work with -rav.
Last edited by tearsforhari; 05-19-2015 at 12:53 PM.
suicidaleggroll:
if I try it with one colon, I get an error:
rsync: change_dir#3 "/root//backups/system/fd-lso-alice" failed: No such file or directory (2)
I am dumping it in the path /backups/system/MachineName/stage/datafolder on the NAS. It is really /Volume1/backups/system/MachineName/stage/datafolder, but the Rsync doesn't work with /Volume1
Yes, indeed. If I use the one semicolon with / AND include the volume1 directory:
>rsync -rav -e ssh --remove-source-files /home/ftp_user/stage/201503 root@IP:/volume1/backups/system/MachineName/stage
(fine)
Everything is good, even with the time stamps.
Or, to summarize, I can use:
>rsync -rv -e ssh --remove-source-files /home/ftp_user/stage/201503 root@IP::backups/system/MachineName/stage
(fine)
And everything works without the time stamps.
I'm having trouble automating the system with ssh-keygen and ssh-copy-id, though. Could you help?.
>ssh-keygen
(fine)
>ssh-copy-id root@IP:/backups/system/MachineName/stage
ssh: Could not resolve hostname IP:/backups/system/fd-lso-alice/stage: Name or service not known
Last edited by tearsforhari; 05-19-2015 at 02:39 PM.
I can ssh to the NAS as root, and there is indeed a directory /root that I can cd to. The .ssh file is empty. I got the following errors:
> ssh-copy-id root@75.36.201.198:/root/.ssh
ssh: Could not resolve hostname 75.36.201.198:/root/.ssh: Name or service not known
> ssh-copy-id root@75.36.201.198:/root
ssh: Could not resolve hostname 75.36.201.198:/root: Name or service not known
I can do the following that works:
> ssh-copy-id root@75.36.201.198
(fine)
>ssh root@75.36.201.198
(fine, no password needed)
I got it!! My problem was that I needed to invoke the following Rsync command:
Ok, one more follow-up question that was asked of me above:
Code:
Me: 2. How would I go about setting rsync and sshkey-gen on a third party linux box, where computer 3 accesses files from computer 1 and transfers them to computer 2?"
Code:
Evo: What do you mean by "setting"? Do you mean installing? If so, then by using the package manager for that system. Why does there need to be a 3rd computer in this scenario? Why can't you copy directly from computer 1 to computer 2?
Well, I probably could do it that way. But I am trying to re-create a shell script that used computer 3 to perform back ups of several other computers 1, 2, 4, 5 etc. How would my script be diiferent? Would I ssh-copy-id from computer 3 to all the other computers?
Last edited by tearsforhari; 05-19-2015 at 02:47 PM.
Help. I really need to rsync from computer1 to computer2, using computer3. I am trying to sync a directory in two computers. I tried the following command on computer3:
>rsync -rav -e ssh user1@75.35.111.205:/home user2@75.35.208.199:/volume1/backups/
The source and destination cannot both be remote.
rsync error: syntax or usage error (code 1) at main.c(1166) [Receiver=3.0.9]
Which means you can't do it. You have two options:
1) computer3 sshs into computer1 and tells it to rsync to computer2 directly (or vice versa)
2) computer3 rsyncs from computer1 to a temporary location on computer3, then rsyncs from that temporary location to computer2
1. SCP on computer3 allows me to transfer files from computer1 to computer2. Can I modify this to mirror a directory tree without having to overwrite files each time?
2. Do you mean SSHFS? How would the command look like? (computer1 and computer2 cannot talk directly to one another)
3. Here's my attempt to use Rsync into two commands, which I would prefer to avoid:
>Rsync user1@host1:/datafolder /tmp
>Rsync -rav -e /tmp user2@host2
4. Here's something that I took off the web that sounds similar:
>SSHFS user1@host1:/datafolder /mnt
>rsync -rauv /mnt user2@host2:/mirrordatafolder
Last edited by tearsforhari; 05-21-2015 at 01:42 PM.
2 - That's not what I mean, but sshfs could work too
3 - You're mixing up flags. There's no point in -a on the second rsync if it's not on the first, and without the recursive flag set on the first you'll skip all directories (-r is included in -a). You also have -e, but no argument for it. ssh is implied, unless you need to modify the ssh parameters just leave "-e ssh" off entirely. You also don't have a path for your destination.
Watch the trailing slash on the source location in rsync. Unlike most other Linux commands the presence/absence of that trailing slash DOES make a difference in rsync. I left it off in my examples, but you may need it, it all depends on your directory structure at the source and destination, and what, exactly, you intend to copy over.
Last edited by suicidaleggroll; 05-21-2015 at 02:14 PM.
Could you write what you intended for SSHS in 2 above? Never heard of SSHS.
Thanks for the tip on Rsync. I take it that the trailing slash is needed when just copying files within the trailing folder, and without is copying the name of the folder and contents?
How could I put 3 or 4 into a cronjob? Shall I make a shell script containing the two or three commands? Little confused on how that would work in a cronjob.
Last edited by tearsforhari; 05-21-2015 at 03:14 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.