[update] Use # as sed's regex separator.

Previously used dash turnes out to be not that uncommon to be
present in user names.  Hash should be less common.
[update] Use mktemp rather than tempfile.

Default installation of Amazon Linux lacks tempfile command but
mktemp is there, so just use it.