Ignore bad behaviors
Some dogs misbehave to get attention, even if this attention is negative. To remedy this type of behavior, you will have to spend more quality time with your pet. That is, playing, walking in the mountains or training.
However, if your dog misbehaves, the best thing is that you pay no attention to it. Remember that scolding him means paying attention to him, and he might misinterpret it as positive reinforcement (since he got what he wanted). Therefore, it is better that you walk away and ignore it.