If you want to use rsync
to transfer files that don't belong to your user to another system you can combine it with sudo
. This doesn't require a direct root
login on the source or target system.
Command
ssh -A -t $SOURCE_SERVER \
'sudo -E rsync -avPhn --rsync-path "sudo rsync" \
/var/lib/foo/ \
$USER@$TARGET_SERVER:/var/lib/bar/'
Explanation
-
ssh -A
: Forward SSH agent -
-t
: Interactive shell for accepting the SSH fingerprint -
sudo -E rsync
: Preserve the environment on the source system to use the forwarded SSH agent -
--rsync-path "sudo rsync"
: Callrsync
asroot
on the target system to allow writing the files -
rsync -n
: Dry-run by default. Remove to actually sync
Related cards:
Use Ubuntu 24.04 (Noble Numbat) with Vagrant
Canonical does not ship Ubuntu 24.04+ Vagrant images due to HashiCorps switch to the [Business Source License (BSL)](https://www.hashicorp.com/...
HowTo: Create scram-sha-256 password hash for use with postgres
If you need to pre-generate a scram-sha256
password hash for use with postgres, e.g. for using it with config management like puppet, pre-generating the password hash can be done in a small oneliner on any machine that has postgres installed:
`...
Don't use flock with GlusterFS
We recently encountered a problem with GlusterFS (7.x) when an application used the flock
syscall on a GlusterFS path. If somehow two flock
syscalls are made at the same time, the lock will never be released. And all future flock
syscalls wi...
Pay attention to trailing slashes when using rsync
When you synchronize directories with rsync
you have to pay attention to use (or not use) trailing /
.
Hint
Use
rsync -nv
to check everything with a dry-run first.
Example:
# without trailing slash
$ mkdir -p a/foo/bar/baz
$ mk...
Installing throttled to fix Lenovo laptops with nvidia graphics running Ubuntu losing performance after a while
We have observed Lenovo laptops with nvidia graphics losing performance after they have been in use for a few minutes. While we have not been able to pinpoint exactly what triggered the performance loss, we have found it mostly correlated with hig...
Find unmaintained packages with apt-forktracer
If you use third party APT sources you might end up with unmaintained packages after removing the external source or performing a dist-upgrade. The reason for this is how external sources overwrite official package versions.
[apt-forktracer
](ht...
How to unban host with Fail2ban
To see all jails:
fail2ban status
Our $JAIL is usually ssh
.
To see which IPs are banned currently:
fail2ban-client status ssh
If you want to unban a host banned by fail2ban on Ubuntu 14.04 or later use this method:
Lenovo Laptop BIOS Update with Linux
You will need to look here and find your own device. Look for the "bootable CD" download, which will give you an ISO file.
Then you need a Perl script from the interne...
Why Apple Silicon MacBooks Can Only Use One External Display Through A Dock
It's quite confusing how many external displays are usable with a MacBook that uses an M1 or M2 Chip. Documentation on the Internet is sparse and not even the Geniuses at the Genius Bar are 100% sure. We found out some things and can explain the b...
Replacing exported resources with puppetdb queries
Instead of using Puppet exported resources you can use the puppetdb_query feature.
This can result...