Skip to content

Instantly share code, notes, and snippets.

@schlomo
Created May 2, 2014 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save schlomo/bc2e5ba3544d45c689c1 to your computer and use it in GitHub Desktop.
Save schlomo/bc2e5ba3544d45c689c1 to your computer and use it in GitHub Desktop.
Simple sed patcher
sed -i -f - /etc/ssh/sshd_config <<EOF
1{
i # this content comes from the %{name}-%{version}-%{release} package
i AddressFamily inet
i Protocol 2
i LogLevel VERBOSE
i HostbasedAuthentication yes
i IgnoreUserKnownHosts yes
i IgnoreRhosts yes
i Banner /etc/ssh/banner.txt
i # end of content from the %{name}-%{version}-%{release} package
}
/Protocol/d
/LogLevel/d
/HostbasedAuthentication/d
/IgnoreUserKnownHosts/d
/IgnoreRhosts/d
/AddressFamily/d
/Banner/d
/%{name}.*package/d
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment