Lucifer is only mentioned once in Ezekiel, in a strange way.
Satan, on the other hand, seems to be God's servant. His name means "the adversary," and while he is the enemy of man, nowhere in the Tanach does Satan ever oppose God.
He first appears in Numbers, where it says,
"But God's anger was kindled because he went, and the angel of YHWH took his stand in the way as Satan."
Balaam doesn't see the angel/Satan, but the donkey does and stops. Balaam hits her three times, and God "opened the mouth" of the donkey, which essentially told him that he was an idiot. Then Balaam suddenly sees the angel, who says:
"Why have you struck your donkey these three times? Look, I came out to oppose you because your way is peverse before me. The donkey saw me and turned away from me these three times. If she had not turned away, believe me; I would have killed you and let her live."
Then Balaam said to the angel of YHWH, "I have sinned...So if it is evil to you, I will go back."
So Satan did nothing bad there; he acted in accordance with God's anger.
He then appears in Job:
Now there was a day when the sons of God came to present themselves before YHWH, and Satan also came among them.
YHWH said to Satan, "From where have you come?"
Satan answered YHWH and said, "From going place to place on the earth, and walking up and down on it.
YHWH said to Satan, "Have you seen my servent Job, that there is no one like him, a blameless and upright man?"
In recap, YHWH asks Satan where he's been. He replied that he'd been on the earth for some time now. YHWH asked him if he'd seen Job. I doubt this was casual conversation; YHWH clearly asked this for a reason.
Satan goes on to say, "Does Job fear God for no reason? Haven't you put a hedge around him and his house and all that he has, on every side? You have blessed the works of his hands, and his possessions have grown in the land. But stretch out your hand and touch all that he has, and he will curse you to your face."
So YHWH answered Satan, "As you wish; all that he has is in your hands. Only against Job himself do not stretch out your hand."
And Satan doesn't. Job passes the test, and Satan goes back to God for permission to sicken Job.
Why would he ask for permission? If he hates God, why would he go into his presence? Why would he warn a man who had made God angry? Why was God's second question if Satan saw Job?
It seems like Satan takes the role of prosecutor in the heavenly court. He also doesn't seem to hate people; the wording of Numbers makes it seem like Satan visited Balaam of his own will to warn Balaam that he had made YHWH angry; nowhere is it written that God sent Satan then.