There are a few ways to go here. But keeping the original definition WITHOUT the illegally word would be best IMO.
The legality would depends on the country, laws and permission. If the access was by the owner's request, legal If not, illegal.
I'm thinking of locksmiths. It would be legal or not for them to open a safe depending on permission.
So hacking doesn't mean it's illegal.