From: Wayne Davison Date: Thu, 4 Jun 2020 19:37:07 +0000 (-0700) Subject: Add hostname "lh" as a --no-cd localhost. X-Git-Tag: v3.2.0pre1~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=55290c858425873a6bf2be7bc841dbb68c023767;p=thirdparty%2Frsync.git Add hostname "lh" as a --no-cd localhost. --- diff --git a/rsync.yo b/rsync.yo index dfcda72b..b62bda8d 100644 --- a/rsync.yo +++ b/rsync.yo @@ -1910,11 +1910,12 @@ is not specified then the user's default groups are used. The option only affects one side of the transfer unless the transfer is local, in which case it affects both sides. Use the bf(--remote-option) to affect the -remote side, such as bf(-M--copy-as=joe). For a local transfer, the "lsh" +remote side, such as bf(-M--copy-as=joe). For a local transfer, the lsh (or lsh.sh) support file provides a local-shell helper script that can be used to allow a -"localhost:" host-spec to be specified without needing to setup any remote -shells (allowing you to specify remote options that affect the side of the -transfer that is using the host-spec, and local options for the other side). +"localhost:" or "lh:" host-spec to be specified without needing to setup any +remote shells, allowing you to specify remote options that affect the side of +the transfer that is using the host-spec (and using hostname "lh" avoids the +overriding of the remote directory to the user's home dir). This option can help to reduce the risk of an rsync being run as root into or out of a directory that might have live changes happening to it and you want to diff --git a/support/lsh b/support/lsh index 2f64d311..81a593b6 100755 --- a/support/lsh +++ b/support/lsh @@ -26,7 +26,9 @@ my $host = shift; if ($host =~ s/^([^@]+)\@//) { $login_name = $1; } -if ($host ne 'localhost') { +if ($host eq 'lh') { + $no_chdir = 1; +} elsif ($host ne 'localhost') { die "lsh: unable to connect to host $host\n"; } @@ -77,5 +79,8 @@ sub usage { die <&2; exit 1 ;; esac done