If the dead person was the only name on the account, then the proper process is that only the executor of the estate has access to the account. The executor isn't legally the executor until a judge says he is, as part of the probate. So the answer is no, it's not legal to take the money. The bank is supposed to lock the account until the executor shows up with the court papers. Good practice is for the executor to move the money into a special estate account. But "legal" here means "civil law". It's not normally a criminal matter.
The executor can ratify actions taken before the grant of probate, either actions taken by himself, or by others.
If the account was a joint account, or if there was a "pay on death" for the account, then things are different.