In this scenario, you have two solutions.
Since you don’t know about the passcode or Apple ID of the previous owner, in that case, you will have to face difficulties because you can’t log into the phone even you have officially and legally purchased the device. Unlikely, in a brand new iPhone 6, in a second hand iPhone 6 you may find that there is iCloud Lock already installed on the device by the previous owner and he may have forgotten to remove it. Therefore, when you purchase a brand new iPhone 6, you have to create an Apple ID and password and those will be needed for you to unlock your device get into the phone. The key purpose of this iPhone iCloud is to prevent anyone from entering to your device and using it without your own permission. Like the same way, iCloud Lock in iPhone 6 is also such a method used by iOS manufacturer to protect the privacy and the safety of your device. You know that there are different methods that are used by different manufacturers to ensure the safety of devices.