Leaning back every once in a while for a quick stretch is totally fine, but you generally want to be sitting up straight with your spine supported and your feet on the floor.