Ali baba is a poor man married to a poor woman, one day he comes across a group of forty thieves. He takes shelter up hiding in a tree while he watches the group open a cave with the words “open sesame” and close it with the phrase “ close sesame”.
Once the men leave he repeats what they do and enters into the cave and to his surprise, there is a lot of gold and wealth. He gathered as much gold as he could and returned back to his wife to show her.
Ali baba’s wife made a comment to the suspicious Cassim, Ali baba’s brother. She bragged about how Ali baba is more wealthy than him now.
This resulted in Ali baba telling his brother where he got the gold and the phrase to get in.
When Cassim went, he forgot the word to say to exit, and when thieves came to see him standing in the cave, killed him. The whole family heard of him dying and saw his body. His body was sewn back together as the robbers had cut him into four pieces.
Over the year Ali baba stayed away from the cave and went back at the end of the year. He saw that no robbers had come to the cave. The secret cave saying was passed down to his son, and so on.