Best Practice for chown

Over the years, I have seen a couple of variations with the use of the chown command. The “:” (colon) vs “.” (dot).  While studying for the RHEL6 exam sometime ago, the books that I had used each had one or the other in their documentation.  I have read that the posix standard is using chown with the “:” (colon).

A quick test reveals why the “:” (colon) is the better fit.

chown user.group /path
chown user:group /path

Nothing unusual there, both commands should work with the same predictable result.

This will work if both the user and the group are the same.

chown user. /path
chown user: /path

How about a username with a “.” (dot) as part of the name?

chown first.last. /path
chown first.last.group /path

Neither one of those will work.

However, this one will.

chown first.last: /path
chown first.last:group /path