Tag Info

New answers tagged

0

@darKoram. For cases where you invoke ssh with non-standard path and try use ssh in ProxyCommand that is problem because there no inheritance. You have two option there: direct provide same file in inner command, or dynamically hack it. You may look detailed description in my blog post about that: ...


3

In general, you should use the distribution's package manager (apt) to install software, and proper configuration management tools (eg, Ansible/Chef/Puppet as mentioned in a comment, or Debian's local debconf) to propagate site-specific information and files. Copying files in bulk is not a good approach. If you have recently configured one machine by hand ...


0

Save them to a file file_list rsync -a --files-from=file_list /source /dest If only these 5 files, then I think you can also use -c (checksum check) and -z (compression) options.


0

rsync -am --include='**/OK/**/*OK*' --include='*/' --exclude='*' --delete-excluded SRS DEST Try this one. -m deletes "empty" directories that were created while traversing SRS sub directories, and --delete-excluded to make rsync not look like cp.


0

rules="+ /Documents/** + /.Play...bases/** + */ - *" echo $rules | rsync -rm -f ". -" --delete-excluded /home/x /dest


0

I came up with the following solution. # exclude system created files like .DS_Store, desktop.ini... arg="-C " # project each "$path" to "/$path/**" and concat 'em all while read line || [[ -n $line ]]; do arg+="+ /$line/** " done < $subdirs # */ - includes each folder so that rsync traverses the whole tree, # * - excludes everything else arg+="+ ...


0

I add this answer since the accepted one doesn't do the required stuff for me (using -p does not prevent rsync to change perms on destination path)! Indeed, the appropriate option here (for NOT changing perms of existing stuff) is --no-perms rsync --no-perms src/ /dest Hereafter extract from the rsync man: In summary: to give destination files (both ...


0

First, why --exclude=* --include=* doesn't work: because the first matching rule applies. * matches everything, so everything is excluded, and rsync doesn't even try the second rule for any file. See Rsync filter: copying one pattern only for a guide to rsync filters. To include .mp3 files, you need rsync -a -m --include='*.mp3' --include='*/' ...


0

You don't need to worry about --include or --exclude for this situation. Just tell rsync to copy the mp3 files that are in the well-structured known places: cd /path/to/source rsync -avR */*/*.mp3 /path/to/target/ Perhaps instead you want to copy all the files in directories that contain an mp3. You can do that with this little loop, again assuming the ...


1

You're trying to do too much with rsync. The first thing to do is to produce the list of all the MP3 files. find Music -type f -iname '*.mp3' Then convert the list of files into a list of the directories that contain the files. sed 's:/[^/]*$::' Eliminate any duplication of directories in the list. sort -u Now you have the list of directories you ...


1

In case you don't want to mess with your local ~/.ssh/config file and the --no-motd option is not working for you either, I had success setting the RSYNC_RSH env variable. RSYNC_RSH="ssh -q" rsync You may also try to use the rsync option -e rsync -e 'ssh -q'


7

You want to use the -s|--protect-args option to rsync. Without it, the part after the : is passed as is to the remote shell so you can use constructs of that shell to build the list to transfer. That way, if you know the remote shell is zsh for instance, you can do: rsync host:'*(.)' there to transfer only regular files. Or with csh/bash/zsh/ksh: rsync ...


2

You need to both quote the path and use a backslash to escape parentheses in the remote path. Either single or double quotes will work. rsync -azR output.mp4 user@server.com:"encoded/somepath/DRRS_\(H264\).mp4" OR rsync -azR output.mp4 user@server.com:'encoded/somepath/DRRS_\(H264\).mp4'


3

Try the below one, I tested this and it is working. You should quote your destination path with ' or " and you should escape the ( and ). rsync -azR output.mp4 user@server.com:'encoded/somepath/DRRS_\(H264\).mp4' UPDATE: Call your script as below, ./sample.sh "encoded/somepath/DRRS_\(H264\).mp4" sample.sh #!/bin/bash rsync -azR output.mp4 ...


2

If you want to skip the unreadable files: find /external/hd/folder ! -readable -print >unreadable_files rsync -a --exclude-from=unreadable_files /external/hd/folder/ /local/folder This assumes that you're using GNU find, and that your filenames don't have embedded newlines. If you want to copy all files, regardless of whether they are readable or not ...


1

If you mount the external HDD to your system locally, then it's not remote. Unless I misunderstood and your HDD is running a rsync daemon and say, connecting over a network? But forget that, can you just mount the drive locally and as @mjturner says, all you need to do is make sure you run rsync as root and it's a direct copy sudo rsync -a ...


0

Why not just use rsync to copy all of the files on the external HDD to the system HDD? It will not re-copy files that already exist. Of course, be sure to do the copy as root to ensure that you copy all files and preserve permissions.


3

Your expressions exclude the contents of the directories (/foo/*), not the directories themselves (/proc). For example: $ mkdir -p foo/{1..3}/{1..3} $ cat exclude.txt /1/* /2 $ rsync -avH --exclude-from=exclude.txt foo/ bar sending incremental file list created directory bar ./ 1/ 3/ 3/1/ 3/2/ 3/3/ sent 296 bytes received 89 bytes 770.00 bytes/sec total ...


4

Your idea is right. Here is a test: /foo$ stat -c '%i-%n' * 658846-egg 656129-spam 656129-test /bar$ rsync -av /foo/ . sending incremental file list ./ egg spam test sent 229 bytes received 76 bytes 610.00 bytes/sec total size is 0 speedup is 0.00 /bar$ stat -c '%i-%n' * 657110-egg 663431-spam 663560-test /bar$ rsync -Hav --delete-delay /foo/ . ...


0

There is another way which I wound up using.. Try using rsync. We find the following: If you specify no local destination then a listing of the specified files on the remote server is provided. The BASH script then becomes: #!/bin/bash localpath=/home/local-acct/path remotelocation=/home/account/logs/archive remotehost=' account@1.2.3.4' rsync -avz ...


2

The reason youd use rsync to sync from ServerA -> ServerB is if users/services need access to the files on the ServerB system. If it's purely for backup as is suggested and users don't need access to read the files then why use rsync? Tar has incremental options and you can pipe it over the network as you would with rsync. ...


2

The sftp command is very limited. If you can't make it do what you want, you can use another approach, which is to mount the remote directory with the SSHFS filesystem. SSHFS uses SFTP as the transport protocol, so the server side just sees an SFTP client. You need to be able to use FUSE on the client side. With SSHFS, you mount the remote directory onto an ...


1

The dir command within sftp client does not support redirection. Example below, showing how it does nothing. sftp> pwd Remote working directory: /var/tmp/foodir sftp> lcd /var/tmp/foodir sftp> dir *.* foo.txt sftp> dir *.* >dirlist.txt foo.txt sftp> dir foo.txt sftp> Man page for sftp confirms. ls [-1afhlnrSt] [path] ...


0

I am not familiar with jailkit so I am not sure about the exact details to implement this, but you could use sluice (http://kernel.ubuntu.com/~cking/sluice/) to rate limit the traffic. A simple solution could be to replace the rsync binary in the user chroot environment with a trivial shell script like: #!/bin/sh -e rsync "$@" | sluice ...


0

Sounds like user wouldn't voluntarily play nice and use --bwlimit each time they invoke rsync. --bwlimit=RATE limit socket I/O bandwidth iptables approach may be covered by this question+answer: serverfault.com: how can I limit per user bandwidth?


7

Restrict the commands that can be invoked by the key If an SSH key is going to be used by any kind of automated or unattended task, you should restrict what commands it is able to execute on a remote machine, no matter what decision you make about how and where to store the key. Use something like this in ~/.ssh/authhrized_keys: ...



Top 50 recent answers are included