The settlement was filed late Thursday with the federal court in San Francisco, and requires a judge’s approval.
It resolves claims that the officials breached their fiduciary duties by knowing about or consciously disregarding the bogus accounts, and failing to stop their creation.
Insurers for 20 current and former Wells Fargo executives and directors, including Chief Executive Tim Sloan and his predecessor John Stumpf, will pay the $240 million to the bank. The officials denied wrongdoing.
Wells Fargo spokesman Peter Gilchrist declined to comment on Friday.
The San Francisco-based bank has been beset by scandals over its sales practices since agreeing in September 2016 to pay $190 million to settle government claims that it created the customer accounts without permission.
Outrage over the settlement and the bank’s handling of the fallout led to Stumpf’s departure. Other sales abuses later surfaced, including Wells Fargo’s charging for unnecessary auto insurance and imposing excessive mortgage fees.
The shareholders in Thursday’s settlement were led by pension plans in Alabama and Colorado.
Their lawyers called the accord the largest insurer-funded cash settlement in a U.S. shareholder derivative lawsuit, surpassing News Corp’s $139 million accord in 2013 over its handling of a phone hacking scandal in Britain.
Shareholders bring derivative lawsuits on behalf of companies, typically when the defendants are corporate officers or board members, with proceeds going to the companies.
Last May, Wells Fargo reached a $480 million settlement of a securities fraud lawsuit brought by shareholders over the unauthorized accounts.
On Wednesday, Wells Fargo said it might have to pay up to $2.7 billion more than it had set aside as of Dec. 31 to resolve legal matters, up from $2.2 billion three months earlier.
In January, Wells Fargo issued a report saying it had improved risk oversight and accountability, including by eliminating sales goals and clawing back compensation from executives.
Sloan nonetheless remains under pressure, and faces calls from Massachusetts Senator Elizabeth Warren, a Democrat running in the 2020 presidential campaign, for his ouster.
The case is In re Wells Fargo & Co Shareholder Derivative Litigation, U.S. District Court, Northern District of California, No. 16-05541.