You may or may not believe in life after death, but in the age of Facebook and Twitter, a tangible part of ourselves can now unquestionably linger after we shuffle off this mortal coil. Our social identities, along with other expressions of our presence online, create digital specters that can cause major headaches for the deceased’s family. But good news: some astute estate planning can help your loved ones exorcise any digital ghosts.

Poltergeist or full-on horror show?

The extent of the digital haunting can range from a nuisance to a complete nightmare, depending on the size of the deceased’s footprint and the nature of their accounts. But whether you expect to be visited by Casper or Freddy Krueger, it’s important not to neglect the digital footprint of a deceased loved one.

“Closing or removing accounts can help prevent identity theft, protect against unauthorized access into financial and non-financial accounts, and prevent assets from going to unclaimed funds, which can create administrative difficulties many years down the road,” says Sarah Rebosa, a partner with the New York firm Cullen and Dykman.

Digital ghosts can wreak havoc on a person’s estate long after they have died. “If pending litigation continues after death, social media can provide an offensive tool against the decedent. If a will contest occurs, surviving family members can gain valuable insight that they would otherwise not have access to, and which could ultimately fuel objections to the decedent’s estate plan,” says Rebosa.

“It’s also critical to consider the local computer, laptop, tablet, smartphone, and let’s not forget the ever-expanding IoT,” says Bradley Glonka, an internet presence specialist with Pistonbroke, a Detroit-based search-engine optimization (SEO) agency, referring to the internet of things (IoT), which links devices so they can collect and exchange digital data.

“Pictures, emails, and important documents can all be lurking on these devices. Recent high-profile incidents have shown how significantly difficult it can be to get into some of these devices,” says Glonka. He adds that while not all equipment is cumbersome to unlock, some people may find it beyond their IT skills or knowledge.

Gain access to crypt

From social media to email, financial accounts to shopping accounts, most people have a plentiful online presence. “These digital venues pose the same obstacle for surviving family members: how to access a loved one’s account and how to know what accounts exist,” says Rebosa. There is an easy way to save those left behind from digging through desk drawers and notepads to retrieve log-ins and passwords: full disclosure of user names and passwords in your estate documents or, at the very least, a list of all digital accounts, from tax documents to online banking, streaming video and music services to photo sites, computer passwords to email accounts – and, the permission to access them.

Having an inventory of the deceased’s digital accounts isn’t necessarily sufficient. Federal and state privacy laws can get in the way of surviving family members seeking to access and gain control over digital accounts so they can settle a person’s estate. “Many states have started to enact legislation that specifically addresses how a fiduciary or other legal representative can access digital assets,” says Rebosa.

Sabrina Winters, an estate planning and elder law attorney in Charlotte, North Carolina, notes that “In North Carolina, the state legislature just enacted the Revised Uniform Fiduciary Access to Digital Assets Act. This statute authorizes you to grant permission, in your estate planning documents, for someone else to access your digital account information after you have passed away,” says. “You can grant this permission to an executor, a trustee, or an agent in your estate planning documents. About 19 other states have similar statutes.”

Andrew Nitkewicz, a partner with Cullen and Dykman, offers another reason for including digital account information in the estate planning documents. “Most of us do not precisely know every single social media account, web-based service provider account, online shopping account, email account, application, or other digital account held by our closest friends and relatives,” says. “Even if we did, accessing those accounts without having each of the decedent’s ever-changing passwords can be near impossible. An estate representative may have to serve the companies with a subpoena simply to gain access to the account, verify the debt, and close the account. This can be very costly.”

While Winters advises her clients to put language in their will, trust, and financial power of attorney to give someone else access to their accounts, there is one challenge that remains. “Many social media outlets and online services have specific requirements on the steps the account owner needs to take to grant access to someone else,” says Winters. “What you say in your will, trust, or power of attorney doesn’t take precedence over the rules of each online service.”

For example, Facebook has a memorialized account option that can be created through a Legacy Contact link under Settings – users select a family member or friend to manage parts of their account (pinned posts, profile photos, header images, friend requests, and archives of photos and posts), or permanently delete it, if something should happen to them. There may be some platforms that close your account after it has been dormant for some time, but the internet is vast and there is room for abandoned accounts to exist forever.

“Platforms like Twitter and Instagram do not yet have these options, and profiles of the deceased live on unmanaged. That old adage to ‘be careful what you post online’ should be taken seriously,” say Stephanie Abrams Cartin and Courtney Spritzer, co-founders of Socialfly, a social media marketing agency in New York City. “Digital footprints are difficult to erase, especially after the original authors have passed away.”

Don’t let sentimentality open the door to shape-shifters

Finally, though some people may be tempted to leave their loved one’s accounts active and online for sentimental reasons, doing so can be an invitation to those shape-shifters who assume another’s identity.

“Identity theft is a major issue in the digital world. Sadly, this obstacle does not necessarily get easier to hurdle upon death. Estates often become targets for criminals stealing identities,” says Nitkewicz. “By using public records such as newspaper articles and obituaries, the identity of the decedent—as well as other personal information which is helpful in gaining access to digital accounts—is used to open digital accounts, access existing accounts, obtain credit cards, and incur other debt on behalf of the unwitting estate representative.”