Skip to content

Instantly share code, notes, and snippets.

@lilongen
lilongen / kdc-configure-file-contents
Last active April 26, 2016 07:04
KDC configure files example
# /etc/krb5.conf
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
dns_lookup_realm = false
ticket_lifetime = 24h
@lilongen
lilongen / kerberos_setup.md
Last active March 1, 2018 07:03 — forked from ashrithr/kerberos_setup.md
Set up kerberos on Redhat/CentOS 7

Installing Kerberos on Redhat 7

This installation is going to require 2 servers one acts as kerberos KDC server and the other machine is going to be client. Lets assume the FQDN's are (here cw.com is the domain name, make a note of the domain name here):

  • Kerberos KDC Server: kdc.cw.com
  • Kerberos Client: kclient.cw.com

Important: Make sure that both systems have their hostnames properly set and both systems have the hostnames and IP addresses of both systems in

@lilongen
lilongen / perl-edit-file-like-sed
Last active April 26, 2016 06:54
perl-edit-file-like-sed, perl stream-edit file like sed, use perl to edit file like sed, sed file using perl
examples:
1). modify file using regular expression pattern single-line mode ( '.' and '\s' match '\n')
perl -i -p0E 's|(<artifactId>api</artifactId>[^<]+<version>)(bbb)(</version>)|\1a\3|g' pom.xml
2). modify file using regular expression pattern multi-line mode
perl -i -pE 's|(<artifactId>api</artifactId>[^<]+<version>)(bbb)(</version>)|\1a\3|g' pom.xml
3). do not modify file actually, just print the changed contents
perl -p0E 's|(<artifactId>api</artifactId>[^<]+<version>)(bbb)(</version>)|\1a\3|g' pom.xml
@lilongen
lilongen / redis-delete-all-matching-keys
Created April 26, 2016 06:16
Delete all keys in redis matching a regular expression
# Deleting all keys in redis that match a regular expression
# General
redis-cli [options] KEYS "prefix:*" | xargs redis-cli [options] DEL
# If authorization is needed
redis-cli -a <AUTH> KEYS "prefix:*" | xargs redis-cli -a <AUTH> DEL
# If no authorization is needed
redis-cli KEYS "prefix:*" | xargs redis-cli DEL