Re: disabling local-to-local transfers?
Damien Miller <[email protected]> Sat, 25 Jul 2026 11:05:45 +1000 (AEST)
| Newsgroups | gmane.network.openssh.devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 24 Jul 2026, Jim Knoble wrote: > > > On Jul 24, 2026, at 10:34, Samuel Thibault <[email protected]> wrote: > > > > [...] > > No, you don't want "smart" tools which try to guess what you actually > > meant, and sometimes get thing wrong and fail horribly. > > You miss my point. Write your own script to do what you want. The feature to detect your mistake (as Theo has pointed out) doesn't belong in scp. Here you go: scp() { local _answer="" local _flagsdone="" local _remote="" for av in "$@" ; do if test -z "$_flagsdone" ; then case "$av" in -*) continue ;; *) _flagsdone=1 ;; esac fi case "$av" in *:*) _remote=1 ;; esac done if test -z "$_remote" ; then cat << _EOF ----- / \\ | o o | | | ----------------------------------------- | | | / \\ | |/ It looks like you're using scp to do a \\ | --- |\\ local to local copy. Are you sure? (y|n) / \\__ | \\________________________________________/ \\_____/ _EOF read -r _answer case "$_answer" in Y*|y*) ;; *) return 1; esac fi /usr/bin/scp "$@" }