Skip to content

Instantly share code, notes, and snippets.

@jadia
Created February 7, 2019 11:30
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 jadia/64160b641fa98585b0902af596638309 to your computer and use it in GitHub Desktop.
Save jadia/64160b641fa98585b0902af596638309 to your computer and use it in GitHub Desktop.
Change entry in a config file

Change an entry in a config file using sed in bash.

sed -r '/PasswordAuthentication/ s/^#/ /; s/(PasswordAuthentication ).*$/\1 no/' ssh_config
        ^ pattern to match        ^remove                             ^ change value
                                  comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment