Skip to main content
pbalasundaram
Gold ⭐️
Mar 2, 2017 11:05 PM UTC

Converting Spaces to Underscores for user names in HDFS

  • Oct 5, 2026 9:27 AM UTC
  • 0 replies
  • 2115 views
  • Translate All

The hadoop.security.auth_to_local under Advanced core-site.xml in HDFS service can be modified to remove spaces in user names. This translation rule is a modification of the default rule

The default rule has a line which removes the domain name

RULE:[1:$1@$0](.*@MYDOMAIN.COM)s/@.*//

In order to translate the user name with Spaces "John Doe@MYDOMAIN.COM" to "John_Doe" The following rule can be used

RULE:[1:$1](.* .*)s/ /_/g/L RULE:[1:$1@$0](.*@MYDOMAIN.COM)s/@.*//

The first rule replaces the Space with the Underscore while retaining the MYDOMAIN.COM and allows second rule also to be respected. This results in successful replacement of usernames with spaces to underscores.