Password management apps like 1Password and LastPass can automatically create strong, lengthy passwords for all your online accounts and keep them stored in a vault that is accessible with one master password.

However, Mr. Grossman said you are better off traveling without your password management software loaded on your devices so that you won’t be asked to hand over the master password to your vault. You could store a copy of the password vault on a cloud service like Dropbox and get access to your vault of passwords when you reach your travel destination, he said.

An alternative to using a password-managing app is to write your passwords down and leave them with someone you trust. After getting through customs, contact that person and ask him or her to read off your passwords.

Use two-step verification

In the unlikely event that you are asked to provide a password to your email or social media account, having two-step verification enabled will act as an extra safeguard — assuming that you left your primary cellphone at home.

With two-step verification turned on, whenever you enter your password, you will receive a text message with a one-time code that you must enter before you can log in. Because the message containing the code would be sent to your phone at home, a customs agent wouldn’t be able to log in to your account even if you gave up your password.

Of course, two-step verification could make logging in to your accounts difficult for yourself if you left your primary cellphone at home. You could always leave your phone with someone you trust and contact them to ask for codes when you are trying to log in. However, it would generally be wiser to stay off your social media accounts while traveling to avoid leaving any traces of data on a burner device.

Encrypt your devices

Whether you are using a burner device or your own, always make sure to lock down the system with encryption, which scrambles your data so it becomes indecipherable without the right key.