And, ``root@serverspec.local`` is a comment, so ``ssh-rsa ABCDE...XYZ root@serverspec.local`` and ``ssh-rsa ABCDE...XYZ foo@bar.local`` are identical.

I think you should check the key without a comment like this.

```ruby
def check_authorized_key user, key
  key.sub!(/\s+[^\s]+$/, '')
  "grep -w '#{key}' ~#{user}/.ssh/authorized_keys"
end
```