Do renters have to lock the front door of their apartment building at night?

As a renter, do I have to lock the front door? What explains it? What’s against it? So what happens if a violation occurs?