Magento 2.1.x ->
Go to Stores > Settings > Configuration > General > Web > Default Cookie Settings > Cookie Lifetime
Magento 1 ->
System > Configuration > Web > Session Cookie Management
Magento 2 backend session timeout
Magento 2.1 admin cookie life time = Stores > Settings > Configuration > Advanced > Admin > Security > Admin Session Lifetime (seconds) or till the user closes the browser