Short answer: You don't.
Longer answer: Note that you should never do this on a production system. You can and likely will mess things up pretty bad, and MS will tell you to pound sand if you call them up asking for help with all of your unsupported/undocumented messing around.
With that out of the way, here we go.
First, you'll need to bring SQL Server up in single-user mode. You've tagged the question "linux", and I don't know if this works exactly the same way, but for the Windows version, just stop the SQL Server service, then launch it from the command line with the "-m" argument, e.g.:
cd "\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn"
Once that's running, you have to connect to the dedicated-administrator connection (DAC) for the instance. You can use any tool you like, e.g. Management Studio or sqlcmd, but note that you can't connect Object Explorer in Management Studio, since it's running in single-user mode. In either case, specify the
ADMIN: prefix for the server name. I think you can do
ADMIN:(local) to connect to a local default instance.
After that, you can pretty much change what you want, but you'll have to figure out what the actual underlying tables are for certain system catalog views. For example,
sys.database_principals. To see the view definition, switch to the "mssqlsystemresource" database (not normally visible), and use
sp_helptext to see the code for any system views/procedures/functions.
EXEC sp_helptext 'sys.server_principals'
You'll notice one of the tables this view references is
master.sys.sysxlgns, which is probably a good place to start. You'll find a column named
pwdhash in this table, which appears to store the hashed passwords.
When you're done tinkering, just go to your command window that's running SQL Server in single-user mode and hit Ctrl-C to shut it down.
Remember, don't do this to a production system, ever, unless Microsoft support has given you specific instructions otherwise. Other than that, have fun, and make sure you've got backups for when you wreck the instance!