I have to transfer (and keep synched) two folders through rsync.
My problem is I always get an error on the remote folder, which I double checked is correct and existing.
Command line I use is:
rsync -rtvIz --chmod=ugo=rwX /cygdrive/c/aus/testrsync/sync remote.server.intranet:/cygdrive/d/testrsync
Error I receive is:
rsync: Failed to exec ssh: No such file or directory (2)
The following command line, using a shared folder on remote DeltaCopy works fine:
rsync -rtvIz --chmod=ugo=rwX /cygdrive/c/aus/testrsync/sync remote.server.intranet::EBackup
It may depend upon exactly what version of rsync you are using on the server side but I don't specify /cygdrive paths for my server path. Using the rsync protocol at least I set the remote URI as rsync://MACHINE:/Dirname/Subdir but I do have to use /cygdrive type paths for the local paths. Then on the Windows server machine that hosts the rsyncd the rsyncd.conf cygwin style paths. eg:
[Builds]
comment = Automated build output
path = /cygdrive/e/Builds
read only = yes
list
This allows normal rsync uri's to be used by clients and the server can then translate these into something it can access on the local filesystem.
Related
Using FTP commands I want to upload a large file once and then copy that file to many directories on the remote FTP server. All the copy commands seems to relate to copying from local to remote or the other way around.
Is there an FTP command to copy remote to remote?
are you trying to move the file? if yes, you can do it using rename command to move the file, as for copy i guess you still have to do the the get,send from local-remote way.
as for move command should be something like this
rename /oldpath/file2move.txt /newpath/file2move.txt
Basically just rename your file path that is infront of the file that you wish to move.
As far as I know, there is no such command available in FTP protocol. There are some extensions to SFTP protocol to do this (and, having SSH access, you can issue cp commands), but SFTP is not an FTP.
I'm trying to copy a directory with files and folders to another directory, first locally to test, and then to a remote server. The tool that I must use is rsync, but after a lot of testing and reading the docs I can't make it work under Windows 7.
For example, when I try
rsync -av D:\source\ D:\dest\
I get the error The source and destination cannot both be remote.
When I try rysnc -av \source\ D:\dest\, I get Error: Failed to exec ssh: No such file or directory (2)
Do you know how can I get it to work?
Thank you.
Cygwin paths are different, to make them Unix-like. Use
rsync -av /cygdrive/d/source/ /cygdrive/d/dest/
D: is interpreted as a remote server called D
Gravedigger coming back to dig this up -
On my windows 8.1 machine it was running everything fine but5 on my Windows 7 machine I was having this same issue. Fixed it by editing vagrant's source -
For me it was here - C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.6.3\plugins\synced_folders\rsync\helper.rb
And I added cygdrive as a prefix and everything is going well -
if Vagrant::Util::Platform.windows?
# rsync for Windows expects cygwin style paths, always.
# Editing source is never fun, but it works : /
hostpath = "/cygdrive" + Vagrant::Util::Platform.cygwin_path(hostpath)
end
I have a requirement to archive files on remote location. i.e., I need to write a shell script that will connect to remote path copy(move) files from this path and then paste them on another location in the same system (The target system could be either a Unix system or a windows system).
This script will be scheduled to run once a day without manual intervention.
Unison should fit your bill. rsync and scp would work as well but they can be a bit cryptic to set up.
There are implementations of the Secure Shell (SSH) for both targeted systems. The Secure Shell comes with a secure copy program, named scp which would allow you to run commands like
scp localfile user#remotehost:directory/remotefilename
As lynxlynxlynx pointed out, another option is the rsync suite. Both SSH and rsync will require some configuration (rsync less so). See the respective home pages.
I'm using ssh to connect with a linux server. I'm trying to upload a file from my own computer(windows7) to linux.
When I type scp Desktop/H5.txt xxUserNamexx#mumble-39.xxServerNamexxx:/u/private/
I got following error:
scp Desktop/H5.txt xxUserNamexx#mumble-39.xxxServerNamexxxx:/u/private/
Desktop/H5.txt: No such file or directory
I can guarantee the server name and the file directory is correct. It seems that scp cannot find my file on my local computer.
What's the default path? What path should I type if the file I'm intending to upload is on my desktop?
Thank you
winscp is a nice option to copy files from MS to *nix. Also pscp is useful. SCP have known issues when used between MS and nix. There seems to be some misunderstanding of folder structure by scp.
drap the H5.txt from desktop to you cmd windows, this can avoid you type the wrong path
In the future you could try using winscp when you're dealing with small files. Also I think a cygwin scp should work just fine.
The slashes are incorrect. On Windows, it should be (assuming you are running Command Prompt from your Home directory):
C:\Users\user> scp Desktop\H5.txt junjue#mumble-39.xxServerNamexxx:/u/j/u/junjue/private/
I'm trying to push changes to my server through ssh on windows (cygwin) using rsync.
The command I am using is:
rsync -rvz -e ssh /cygdrive/c/myfolder/ rsyncuser#192.168.1.110:/srv/www/prj112/myfolder/
/srv/www/prj112/myfolder/ is owned by rsyncuser. My problem is that eventhough with rsync the sub directories are create as they publish, each directory is assigned default permission of d--------- so rsync fails to copy any files inside it.
How do I fix this?
The option to ignore NTFS permissions has changed in Cygwin version 1.7. This might be what's causing the problem.
Try adding the 'noacl' flag to your Cygwin mounts in C:\cygwin\etc\fstab, for example:
none /cygdrive cygdrive user,noacl,posix=0 0 0
You can pass custom permissions via rsync using the 'chmod' option:
rsync -rvz --chmod=ugo=rwX -e ssh source destination
Your problem stems from the fact that the Unix permissions on that directory really are 0. All of the access information is stored in separate ACLs, which rsync does not copy. Thus, it sets the permissions on the remote copy to 0, and, obviously, is unable to write to that directory afterwards.
You can run
chmod -R 775
on that directory, which should fix your rsync problem.
After a look at the manpage I can tell that the chmod param is available in rsync since version ~2.6.8. But you have to use --chmod=ugo=rwX in combination with rsync -av
You should also try this command:
rsync -av <SOURCE_DIR> rsyncuser#192.168.1.110:/srv/www/prj112/myfolder
It would work on Linux at least. And note that rsync does not need to mention ssh--at least on Linux.
But if all fails and just to give an option you may take a look at this ready packed-up tool cwRsync
if you deploy a site from windows (for ex. octopress use rsync) it's possible set permission to 775 adding multiple chmod command:
rsync -avz --chmod=ug=rwx --chmod=o=rx -e ssh
To rsync from Windows to Unix/Linux you should provide a command like
SET BACKUP_SERVER=my.backup.server
SET SSH_USER=theUnixUserName
SET STORAGEPATH=/home/%SSH_USER%/Backup/
SET STORAGEURI=%BACKUP_SERVER%:%STORAGEPATH%
SET SSH_ID=/cygdrive/c/Users/theWindowsUserName/Documents/keyfiles/id_dsa
SET EXCLUDEFILE=backup_excludes.txt
SET BACKUPLOGFILE=/cygdrive/c/Users/theWindowsUserName/Backuplogs/backup-%DATE%-%TIME::=-%.log
The ssh command then is
SET BACKUP=rsync -azvu --chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r --rsh="ssh -l %SSH_USER% -i '%SSH_ID%'" --exclude-from=%EXCLUDEFILE% --delete --delete-excluded --log-file="%BACKUPLOGFILE%"
with backup_excludes.txt containing lines of ignored elements like
.git
.svn
.o
\Debug
\Release
Then you would use this in a script with
%BACKUP% /cygdrive/c/mySensibleData %STORAGEURI%
%BACKUP% /cygdrive/c/myOtherSensibleData %STORAGEURI%
%BACKUP% /cygdrive/c/myOtherSensibleData2 %STORAGEURI%
and so on. This will backup your directories mySensibleData, myOtherSensibleData and myOtherSensibleData2 with the permissions 755 for directories and 644 for files. You also get backup logs in your %BACKUPLOGFILE% for each backup.
Cygwin rsync will report permission denied when some process has the target file open. Download and run Process Explorer and find out if anything else is locking the file or simply try renaming the file and see if you get the Windows error about some other process having the file open.
Also, you can try to create a (global) environment variable CYGWIN and set its value to nontsec