[Bug 3660] Prevent disastrous unintended local copying
    bugzilla-daemon at mindrot.org 
    bugzilla-daemon at mindrot.org
       
    Fri Jan 26 17:58:41 AEDT 2024
    
    
  
https://bugzilla.mindrot.org/show_bug.cgi?id=3660
Jim Knoble <jmknoble at pobox.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmknoble at pobox.com
--- Comment #1 from Jim Knoble <jmknoble at pobox.com> ---
In your $HOME/.profile or $HOME/.bashrc add the following function:
scp() {
    case "$*" in
        *:*|*-h|'')
            command scp ${1:+"$@"}
            ;;
        *)
            echo "scp: error: Use cp(1) to copy files locally" >&2
            return 1
            ;;
    esac
}
(Warning: untested).
That should put a safety on your footgun without modifying the scp
binary, *and* it will work on just about any version of scp.
If you need a fancier footgun safety, consider a Python script that
wraps the scp command and appears earlier on $PATH.
-- 
You are receiving this mail because:
You are watching the assignee of the bug.
    
    
More information about the openssh-bugs
mailing list