The vaultguards are an exceedingly rare NetHack monster. They will appear occasionally when a player is in a vault (Suddenly, one of the vault's guards appear!) and will accost the player.

In most circumstances, the guard will ask your name (with a small alignment penalty for lying if you are lawful) and then demand that you drop all of your gold ("Most likely all of your gold was stolen from this vault.") and follow him out. If you throw your gold at the guard he will catch it and say "That should do. Now beat it!"; if you drop it, it will remain where it is and you can return later. In either case he will open a passage from the vault to a nearby corridor and wait for you to follow him. When you reach the corridor he, the passage, and anything left inside it will vanish.

He will attack if you persistently ignore his orders, attempt to escape by some other means (such as teleportation), or, obviously, if you initiate combat. If he dies in his passageway, it will close leaving you embedded in rock, and his corpse and possessions (including any gold you threw him) will vanish never to be see again. You can recover these only if you lure the guard out of his passage (typically, into the vault itself) before killing him or digging your way back.

There are several ways to avoid fighting a guard:

Tell them your name is Croesus (or Kroisos or Creosote); if Croesus has not been killed the guard will leave in peace ("oh, yes, of course. Sorry to have disturbed you") but you will still be trapped in the vault. If Croesus has been killed, however, the guard immediately turns hostile ("Back from the dead, are you? I'll remedy that!"), without the chance to pacify them by dropping one's gold. Under most circumstances, of course, a game where Croesus is dead is a game where the player is easily powerful enough to handle a vault guard.

Eat a mimic corpse, which temporarily transforms you into a pile of gold; if the guard appears while you are in this state, they will turn around and leave, puzzled. (If you are hallucinating, you turn into an orange instead; the guard will still leave - "Hey! Who left that orange in here?")

Do not stick around long enough in the vault to let them appear.

Be polymorphed into something that cannot speak (the guard will say "I'll be back when you're ready to speak to me!")

Or be polymorphed into something that can hide under items, being hidden, making them turn around and leave, puzzled.

Engrave on the floor, or do something else that prevents you from speaking to the guard.

Some high level chaotic players kill guards systematically as these are occasionally generated with good items. Non-human characters can also feed on the corpses without suffering the penalties for cannibalism. Such a player could theoretically stay in the vault indefinitely doing so.