mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-04-30 19:15:39 -04:00
Add hostname "lh" as a --no-cd localhost.
This commit is contained in:
9
rsync.yo
9
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
|
||||
|
||||
@@ -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 <<EOT;
|
||||
Usage: lsh [-l user] [--sudo] [--no-cd] localhost COMMAND [...]
|
||||
|
||||
Note that if you pass hostname "lh" instead of "localhost" that
|
||||
the --no-cd option is implied.
|
||||
EOT
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# command.
|
||||
|
||||
user=''
|
||||
do_cd=y # Default path is user's home dir, just like ssh.
|
||||
do_cd=y # Default path is user's home dir (just like ssh) unless host is "lh".
|
||||
|
||||
while : ; do
|
||||
case "$1" in
|
||||
@@ -16,6 +16,7 @@ while : ; do
|
||||
--no-cd) do_cd=n; shift ;;
|
||||
-*) shift ;;
|
||||
localhost) shift; break ;;
|
||||
lh) do_cd=n; shift; break ;;
|
||||
*) echo "lsh: unable to connect to host $1" 1>&2; exit 1 ;;
|
||||
esac
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user