<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.bitcoin.it/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=D-man97</id>
	<title>Bitcoin Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://en.bitcoin.it/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=D-man97"/>
	<link rel="alternate" type="text/html" href="https://en.bitcoin.it/wiki/Special:Contributions/D-man97"/>
	<updated>2026-05-07T22:19:04Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Why_a_GPU_mines_faster_than_a_CPU&amp;diff=12496</id>
		<title>Why a GPU mines faster than a CPU</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Why_a_GPU_mines_faster_than_a_CPU&amp;diff=12496"/>
		<updated>2011-07-05T06:02:01Z</updated>

		<summary type="html">&lt;p&gt;D-man97: Removed duplicate word.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Some Bitcoin users might wonder why there is a huge disparity between the mining output of a CPU versus a GPU.&lt;br /&gt;
&lt;br /&gt;
First, just to clarify, the CPU, or &#039;&#039;central processing unit&#039;&#039;, is the part of the computer that performs the will of the software loaded on the computer.  It&#039;s the main executive for the entire machine.  It is the master that tells all the parts of the computer what to do - in accordance with the program code of the software, and, hopefully, the will of the user.&lt;br /&gt;
&lt;br /&gt;
Most computers have multi-core CPUs nowadays (which is almost the same thing as having multiple CPU&#039;s in a single physical package)., and some computers (such as the Mac Pro)  even have multiple CPUs.&lt;br /&gt;
&lt;br /&gt;
The CPU is usually a removable component that plugs into the computer&#039;s main circuit board, or &#039;&#039;motherboard&#039;&#039; and sits underneath a large, metallic heat sink which usually has a fan, a few are cooled by water.&lt;br /&gt;
&lt;br /&gt;
The GPU, or &#039;&#039;graphics processing unit&#039;&#039;, is a part of the video rendering system of a computer. The typical function of a GPU is to assist with the rendering of 3D graphics and visual effects so that the CPU doesn&#039;t have to.&lt;br /&gt;
&lt;br /&gt;
Servers usually have very limited or no GPU facilities as they are mostly managed over a text-based remote interface. Most mainstream computers have much slower but less power consuming and cheaper IGPs (Integrated Graphics Processor), which are GPUs as well but integrated directly into the chipset and soldered onto the motherboard, rather than separate, more powerful but power consuming AGP or PCIe cards with GPUs, but separate GPUs. Powerful GPUs are needed mostly for graphic intensive task such as gaming or video editing. For example, the translucent windows in Windows 7, or technologies like Mac OS X&#039;s Quartz, which powers the Aqua desktop and it&#039;s beautiful, water-like graphical effects and animations such as bulging the Dock in a smooth animation when the mouse is moved to the lower edge of the screen  or &amp;quot;sucking&amp;quot; windows into the Dock when they are minimized - these are powered by GPUs.&lt;br /&gt;
&lt;br /&gt;
A GPU is like a CPU, but there are important internal differences that make them suited toward their special tasks.  These are the differences that make Bitcoin mining far more favorable on a GPU.&lt;br /&gt;
&lt;br /&gt;
== Short Answer ==&lt;br /&gt;
&lt;br /&gt;
A  CPU core can execute &#039;&#039;&#039;4&#039;&#039;&#039; 32-bit instructions per clock (using a 128-bit SSE instruction) or &#039;&#039;&#039;8&#039;&#039;&#039; via AVX (256-Bit), whereas a GPU like the Radeon HD 5970 can execute &#039;&#039;&#039;3200&#039;&#039;&#039; 32-bit instructions per clock (using its 3200 ALUs or shaders). This is a difference of &#039;&#039;&#039;800 (or 400 in case of AVX) times more instructions per clock&#039;&#039;&#039;. As of 2011, the fastest CPUs have up to 6, 8, or 12 cores and a somewhat higher frequency clock (2000-3000 MHz vs. 725 MHz for the Radeon HD 5970), but one HD5970 is still more than five times faster than four 12-core CPUs at 2.3GHz (which would also set you back about $4700 rather than $350 for the HD5970).&lt;br /&gt;
&lt;br /&gt;
== A CPU is an executive ==&lt;br /&gt;
A CPU is designed primarily to be an executive and make decisions, as directed by the software.  For example, if you type a document and save it, it is the CPU&#039;s job to turn your document into the appropriate file type and direct the hard disk to write it as a file.  CPU&#039;s can also do all kinds of math, as inside every CPU is one or more &amp;quot;Arithmetic/Logic Units&amp;quot; (ALU&#039;s).  CPU&#039;s are also highly capable of following instructions of the &amp;quot;if this, do that, otherwise do something else&amp;quot;.  A large bulk of the structures inside a CPU are concerned with making sure that the CPU is ready to deal with having to switch to a different task on a moment&#039;s notice when needed.&lt;br /&gt;
&lt;br /&gt;
CPU&#039;s also have to deal with quite a few other things which add complexity, including:&lt;br /&gt;
* enforcing privilege levels and the boundaries between user programs and the operating system&lt;br /&gt;
* creating the illusion of &amp;quot;virtual memory&amp;quot; to programs&lt;br /&gt;
* for the most popular processors, being backwards compatible with legacy code&lt;br /&gt;
&lt;br /&gt;
== A GPU is a laborer ==&lt;br /&gt;
A GPU is very different.  Yes, a GPU can do math, and can also do &amp;quot;this&amp;quot; and &amp;quot;that&amp;quot; based on specific conditions.  However, GPU&#039;s have been designed so they are very good at doing video processing, and less executive work.&lt;br /&gt;
&lt;br /&gt;
Video processing is a lot of repetitive work, since it is constantly being told to do the same thing to large groups of pixels on the screen.  In order to make this run efficiency, video processors are far heavier on the ability to do repetitive work, than the ability to rapidly switch tasks.&lt;br /&gt;
&lt;br /&gt;
GPU&#039;s have large numbers of ALU&#039;s, more so than CPU&#039;s.  As a result, they can do large amounts of bulky mathematical labor in a greater quantity than CPU&#039;s.&lt;br /&gt;
&lt;br /&gt;
==Analogy==&lt;br /&gt;
One way to visualize it is a CPU works like a small group of very smart people who can quickly do any task given to them.  A GPU is a large group of relatively dumb people who aren&#039;t individually very fast or smart, but who can be trained to do repetitive tasks, and collectively can be more productive just due to the sheer number of people.&lt;br /&gt;
&lt;br /&gt;
It&#039;s not that a CPU is fat, spoiled, or lazy.  Both CPUs and GPUs are creations made from billions of microscopic transistors crammed on a small piece of silicon.  On silicon chips, size is expensive.  The structures that make CPUs good at what they do take up lots of space.  When those structures are omitted, that leaves plenty of room for many &amp;quot;dumb&amp;quot; ALU&#039;s, which individually are very small.&lt;br /&gt;
&lt;br /&gt;
The ALUs of a GPU are partitioned into groups, and each group of ALUs shares management, so members of the group cannot be made to work on separate tasks.  They can either all work on nearly identical variations of one single task, in perfect sync with one another, or nothing at all.  Trying different hashes repeatedly - the process behind Bitcoin mining - is a very repetitive task suitable for a GPU, with each attempt varying only by the changing of one number (called a &amp;quot;nonce&amp;quot;) in the data being hashed.&lt;br /&gt;
&lt;br /&gt;
The ATI Radeon 5970 is a popular video card for Bitcoin mining and, to date, offers the best known performance of any video card for this purpose.&lt;br /&gt;
&lt;br /&gt;
This particular card has 3,200 &amp;quot;Stream Processors&amp;quot;, which can be thought of as 3,200 very dumb execution units that can be trained to all do the same repetitive task, just so long as they don&#039;t have to make any decisions that interrupts their flow. Those execution units are contained in blocks. The 5970 uses a VLIW-5 architecture, which means the 3,200 Stream Processors are actually 640 &amp;quot;Cores,&amp;quot; Each able to process 5 instruction per clock cycle. Nvidia would call these cores &amp;quot;Cuda Cores&amp;quot;, but as mentioned in this article, they are not VLIW, meaning they cannot do as much work per cycle. This is why comparing graphics cards by core count alone is not an accurate method of determining performance, and this is also why nVidia lags so far behind ATI in SHA-256 hashing.&lt;br /&gt;
&lt;br /&gt;
Since ALU&#039;s are what do all the work of Bitcoin mining, the number of available ALU&#039;s has a direct effect on the hash output.  Compare that to a 4-core CPU that can switch tasks on a dime, but has ALU&#039;s in some small multiple of four, if not just four ALU&#039;s alone.  Trying a single SHA256 hash in the context of Bitcoin mining requires around 1,000 simple mathematical steps that must be performed entirely by ALU&#039;s.&lt;br /&gt;
&lt;br /&gt;
That, in a nutshell, is why GPU&#039;s can mine Bitcoins so much faster than CPU&#039;s.  Bitcoin mining requires no decision making - it is repetitive mathematical work for a computer.  The only decision making that must be made in Bitcoin mining is, &amp;quot;do I have a valid block&amp;quot; or &amp;quot;do I not&amp;quot;.  That&#039;s an excellent workload to run on a GPU.&lt;br /&gt;
&lt;br /&gt;
==Why are AMD GPUs faster than Nvidia GPUs?==&lt;br /&gt;
&lt;br /&gt;
Firstly, AMD designs GPUs with many simple ALUs/shaders (VLIW design) that run at a relatively low frequency clock (typically 1120-3200 ALUs at 625-900 MHz), whereas Nvidia&#039;s microarchitecture consists of fewer more complex ALUs and tries to compensate with a higher shader clock (typically 448-1024 ALUs at 1150-1544 MHz). Because of this VLIW vs. non-VLIW difference, Nvidia uses up more square millimeters of die space per ALU, hence can pack fewer of them per chip, and they hit the frequency wall sooner than AMD which prevents them from increasing the clock high enough to match or surpass AMD&#039;s performance. This translates to a raw ALU performance advantage for AMD:&lt;br /&gt;
* AMD Radeon HD 6990: 3072 ALUs x 830 MHz = 2550 billion 32-bit instruction per second&lt;br /&gt;
* Nvidia GTX 590: 1024 ALUs x 1214 MHz = 1243 billion 32-bit instruction per second&lt;br /&gt;
This approximate &#039;&#039;&#039;2x-3x&#039;&#039;&#039; performance difference exists across the entire range of AMD and Nvidia GPUs. It is noticeably visible in all ALU-bound GPGPU workloads such as Bitcoin, password bruteforcers, etc.&lt;br /&gt;
&lt;br /&gt;
Secondly, another difference favoring Bitcoin mining on AMD GPUs instead of Nvidia&#039;s is that the mining algorithm is based on SHA-256, which makes heavy use of the 32-bit integer right rotate operation. This operation can be implemented as a single hardware instruction on AMD GPUs, but requires three separate hardware instructions to be emulated on Nvidia GPUs (2 shifts + 1 add). This alone gives AMD another &#039;&#039;&#039;1.7x&#039;&#039;&#039; performance advantage (~1900 instructions instead of ~3250 to execute the SHA-256 compression function).&lt;br /&gt;
&lt;br /&gt;
Combined together, these 2 factors make AMD GPUs overall &#039;&#039;&#039;3x-5x&#039;&#039;&#039; faster when mining Bitcoins.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Mining hardware comparison]]&lt;br /&gt;
* [[:Category:Miners|Miners]]&lt;br /&gt;
* [[:Category:Pool Operators|Pool Operators]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Mining]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12261</id>
		<title>Securing your wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12261"/>
		<updated>2011-07-02T08:39:52Z</updated>

		<summary type="html">&lt;p&gt;D-man97: /* Linux solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Wallet security can be broken down into two independent goals:&lt;br /&gt;
# Protecting your wallet against loss.&lt;br /&gt;
# Protecting your wallet against theft.&lt;br /&gt;
&lt;br /&gt;
In the case that your current wallet hasn&#039;t been protected adequately (e.g. put online with a weaker password):&lt;br /&gt;
# Making a new secure wallet, using appropriate long-term protection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For a brief overview see also: [[Wallet Security Dos and Don&#039;ts (Windows)|Wallet Security Dos and Don&#039;ts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Technical Background==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions send Bitcoins to a specific public key. A Bitcoin address is an encoded hash of a public key. In order to use received Bitcoins, you need to have the private key matching the public key you received with. This is sort of like a super long password associated with an account (public key). Your Bitcoin wallet contains all of the private keys necessary for spending your received transactions. If you delete your wallet without a backup, then you no longer have the authorization information necessary to claim your coins, and the coins associated with those keys are lost forever.&lt;br /&gt;
&lt;br /&gt;
The wallet contains a pool of queued keys. By default there are 100 keys in the [[key pool]].  The size of the pool is configurable using the &amp;quot;-keypool&amp;quot; command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.&lt;br /&gt;
&lt;br /&gt;
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.&lt;br /&gt;
&lt;br /&gt;
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient&#039;s public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.&lt;br /&gt;
&lt;br /&gt;
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.&lt;br /&gt;
&lt;br /&gt;
== Making a new wallet ==&lt;br /&gt;
&lt;br /&gt;
In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.&lt;br /&gt;
&lt;br /&gt;
For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised.  Just re-encrypting isn&#039;t secure.  One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).&lt;br /&gt;
&lt;br /&gt;
==Making a secure workspace==&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
The first step is to make a [http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/ new user,] so run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser new_user_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as root. When you get to the prompt &#039;Enter the new value, or press ENTER for the default&#039;, just keep hitting ENTER.&lt;br /&gt;
&lt;br /&gt;
Then switch user to the new user.  To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the &#039;System/Quit&#039; screen, or if there is no switch icon on your system you can log out and log back in as the new user.  Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.&lt;br /&gt;
&lt;br /&gt;
For secure browsing, open Firefox, and then go into the Edit menu and click Preferences.  Starting from the left, click on the General tab, and in the &#039;Startup/When Firefox starts&#039; pop up menu, choose &#039;Show a Blank Page&#039;.  Then click on the Content tab, and deselect &#039;Load images automatically&#039; and deselect &#039;Enable Javascript&#039;.  Then click on the Privacy tab, and in the &#039;History/Firefox will&#039; pop up menu, choose &#039;Never remember history&#039;.  Then click on the Security tab, and in the Passwords section, deselect &#039;Remember passwords for sites&#039; and deselect &#039;Use a master password&#039;.  Then click on the Advanced tab, then click on the Update tab, and then in the &#039;Automatically check for updates to&#039; section, deselect &#039;Add-ons&#039; and &#039;Search Engines&#039;.&lt;br /&gt;
&lt;br /&gt;
When javascript is disabled, the [http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.23/bitcoin-0.3.23-linux.tar.gz/download linux download page] will not download automatically, so you&#039;ll have to click on the &#039;direct link&#039; part of the &amp;quot;Problems with the download? Please use this &#039;direct link&#039; or try another mirror.&amp;quot; line.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve made your secure new user, to maintain security you should use it only for bitcoin.&lt;br /&gt;
&lt;br /&gt;
It&#039;s also a good idea to encrypt the Home directory of whatever user you run Bitcoin under using ecryptfs-utils. To do this:&lt;br /&gt;
# If the Home directory is not empty you should back it up first, by just copying the data to an external drive or something.&lt;br /&gt;
# install ecryptfs-utils (on Ubuntu: sudo apt-get install ecryptfs-utils)&lt;br /&gt;
# log out of X (graphical system) and press Ctrl+Alt+F1 to login to the command shell (you must be logged out or some files will be open and the tool won&#039;t be able to encrypt your data)&lt;br /&gt;
# change directory to something that&#039;s not in your home folder (ex: cd / )&lt;br /&gt;
# run the migration tool (on Ubuntu: sudo ecryptfs-migrate-home -u username)&lt;br /&gt;
# if it&#039;s successful, you can now press ALT+F8 to go back to the GUI and login&lt;br /&gt;
# run &#039;ecryptfs-unwrap-passphrase&#039; and &#039;&#039;&#039;WRITE DOWN OR SAVE THE CODE IT RETURNS&#039;&#039;&#039; because you will need it if you ever have to pull your data off while the OS is not working. (You can run it again later if you need to, but run it now so that you can get your data if your Linux install gets botched.)&lt;br /&gt;
# run &#039;ecryptfs-setup-swap&#039; to encrypt your swap partition (the encrypted folder data is not encrypted while it&#039;s in memory, and so if it&#039;s ever sent to the swap partition it can be stolen from there unless that too is encrypted - be aware that this will mean you cannot use Hibernate anymore, as the bootloader won&#039;t be able to restore the hibernation data)&lt;br /&gt;
(instructions from [http://bodhizazen.net/Tutorials/Ecryptfs/#Migrate])&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
=====Backup all data (500MB)=====&lt;br /&gt;
Follow these instructions to backup all the bitcoin data (wallet and block chains) to an encrypted disk image.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 500MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move everything from ~/Library/Application Support/Bitcoin/ to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin ~/Library/Application Support/Bitcoin&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
=====Backup just wallet.dat (40MB)=====&lt;br /&gt;
Follow these instructions to backup just the wallet.dat file. This results in a smaller disk image, but it&#039;s more complicated to do.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 40MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move your wallet.dat file to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin/wallet.dat ~/Library/Application Support/Bitcoin/wallet.dat&lt;br /&gt;
&lt;br /&gt;
[[File:MountWalletAndLauchnBitcoin_OSX_Automator.png|thumbnail|150px|Mount Wallet and launch Bitcoin]]&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you start the Bitcoin application without having the image mounted, the application will overwrite your symlink with a new wallet. If that happens, don&#039;t panic. Just delete the new wallet.dat, mount the image, and recreate the symlink like above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Automation&#039;&#039;&#039;: You can create a small application using [http://en.wikipedia.org/wiki/Automator_%28software%29 Automator] (included in OS X) to automatically mount the wallet and then launch Bitcoin App. See the Screenshot on how to do this.&lt;br /&gt;
&lt;br /&gt;
If one &#039;&#039;doesn&#039;t&#039;&#039; want to use encrypted Disk images, then a &#039;&#039;&#039;small shell script&#039;&#039;&#039; can be used instead that takes care of decrypting the wallet, launching bitcoin client, and encrypting it after the client exits. This script works on both OSX and Linux: [http://lorelei.kaverit.org/bitcoin.sh bitcoin-launch-script]&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
If you are using Windows XP or Windows 7, you can keep your wallet on an encrypted disk image created by third-party software, such as [http://www.truecrypt.org/ TrueCrypt] (open source) or [http://www.jetico.com/encryption-bestcrypt/ Jetico BestCrypt] (commercial).  You can probably do the same with Windows Vista or Windows 2000.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You should configure BitCoin in this manner only on computers where you use BitCoin, but do not use that computer to mine.  For example, this is a good configuration for a notebook or tablet computer.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have installed the Windows BitCoin client and run it at least once, the process is described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;To mount the BitCoin data directory on an encrypted drive&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol start=1 type=1&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the third-party disk image encryption program of your choice to create and mount an encrypted disk image of at least 100 MB in size.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Locate the BitCoin data directory, and copy the directory with all contents to the encrypted drive.&lt;br /&gt;
&amp;lt;p&amp;gt;For help finding this directory, see &amp;lt;b&amp;gt;[[Securing_your_wallet#Locating_BitCoin_s_data_directory|Locating BitCoin&#039;s Data Directory]]&amp;lt;/b&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a Windows shortcut that starts BitCoin with the &amp;lt;code&amp;gt;-datadir&amp;lt;/code&amp;gt; parameter and specifies the encrypted drive and directory.&lt;br /&gt;
&amp;lt;p&amp;gt;For example, if you installed Bitcoin in the default directory, mounted your BitCoin encrypted drive as &amp;lt;code&amp;gt;E:\&amp;lt;/code&amp;gt;, and stored your BitCoin data directory on it as &amp;lt;code&amp;gt;Bitcoin&amp;lt;/code&amp;gt;, you would type the following command as the shortcut Target:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;C:\Program Files\Bitcoin\bitcoin.exe -datadir=E:\Bitcoin&amp;lt;/code&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open BitCoin&#039;s settings and configure it &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; to start automatically when you start Windows.&lt;br /&gt;
&amp;lt;p&amp;gt;This is to allow you to mount the BitCoin encrypted disk image before starting BitCoin.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Shut down BitCoin, and then restart it from the new shortcut.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After doing this, any time you want to use BitCoin, you must first mount the BitCoin encrypted disk image using the same drive designation, and then run BitCoin from the shortcut that you created, so that it can find its data and your wallet. :-)&lt;br /&gt;
&lt;br /&gt;
== Locating BitCoin&#039;s data directory ==&lt;br /&gt;
&lt;br /&gt;
The [[data directory]] is the location where Bitcoin&#039;s data files are stored, including the wallet data file.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
Go to Start -&amp;gt; Run (or press WinKey+R) and run this:&lt;br /&gt;
&lt;br /&gt;
 explorer %APPDATA%\BitCoin&lt;br /&gt;
&lt;br /&gt;
BitCoin&#039;s data folder will open. For most users, this is the following locations:&lt;br /&gt;
&lt;br /&gt;
 C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)&lt;br /&gt;
 &lt;br /&gt;
 C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;AppData&amp;quot; and &amp;quot;Application data&amp;quot; are hidden by default.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/.bitcoin/&lt;br /&gt;
&lt;br /&gt;
You need to do a &amp;quot;ls -a&amp;quot; to see directories that start with a dot.&lt;br /&gt;
&lt;br /&gt;
If that&#039;s not it, you can do a search like this:&lt;br /&gt;
&lt;br /&gt;
 find / -name wallet.dat -print 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/Library/Application Support/Bitcoin/&lt;br /&gt;
&lt;br /&gt;
==Backup==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: I would strongly recommend against using Dropbox to back up your Bitcoin data due to [http://en.wikipedia.org/wiki/Dropbox_(service)#Criticism security concerns] such as:&lt;br /&gt;
# the fact that they store your encryption key (meaning that a disgruntled Dropbox employee or an attacker who gained access to the system could decrypt your Dropbox data and steal your Bitcoins)&lt;br /&gt;
# the fact that the Dropbox client only needs a password for the first login. After it authenticates once, the server assigns it a token which it uses to show that, at one time, its user knew the password rather than sending the actual password (meaning that if you ever use the Dropbox client on another PC, that PC&#039;s users can access your Dropbox - even if you change your password - and can steal your Bitcoins or get a virus that will steal your Bitcoins).&lt;br /&gt;
&lt;br /&gt;
For these reasons, I personally prefer to use Wuala, which does not store your encryption key and requires a password each time (the client can be set to remember your password, but the server will check each time to make sure that the client is sending the correct password). Like Dropbox, the basic, lowest-storage-space account with Wuala is free of charge, and coincidentally, Wuala [http://www.wuala.com/en/bitcoin is experimenting with allowing users to pay for &amp;quot;upgraded&amp;quot; plans using Bitcoin.]&lt;br /&gt;
&lt;br /&gt;
In fact, whether you use Dropbox as your backup or not, use what Steve Gibson calls &amp;quot;pre-Internet encryption&amp;quot; (which he actually [http://itknowledgeexchange.techtarget.com/security-corner/cloud-security-and-privacy-do-they-exist/ discussed in the context of Dropbox&#039;s security concerns]) and use some form of encryption on the files before you back them up, just in case someone other than yourself ever gains access to that backup. Make sure to pick a password that&#039;s memorable but secure.&lt;br /&gt;
&lt;br /&gt;
The only file you need to back up is &amp;quot;wallet.dat&amp;quot;. Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.&lt;br /&gt;
&lt;br /&gt;
You can use the [[api|backupwallet]] JSON-RPC command to back up without shutting down Bitcoin.&lt;br /&gt;
&lt;br /&gt;
=== General Solutions ===&lt;br /&gt;
&lt;br /&gt;
Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.&lt;br /&gt;
* [http://www.7-zip.org/ 7-zip] - Supports strongly-encrypted archives.&lt;br /&gt;
* [http://www.axantum.com/axcrypt/ AxCrypt]&lt;br /&gt;
* [http://lrzip.kolivas.org lrzip] - Compression software for Linux and OSX that supports very high grade password protected encryption&lt;br /&gt;
* [http://www.truecrypt.org/ TrueCrypt] - Volume-based on-the-fly encryption (for advanced users)&lt;br /&gt;
* [http://www.rarlab.com/ WinRar] - Commonly used archive software that supports verification records and encryption.&lt;br /&gt;
&lt;br /&gt;
There is also a list of [[OpenSourceEncryptionSoftware|open source encryption software.]]&lt;br /&gt;
&lt;br /&gt;
Decrypting and encrypting the wallet.dat every time you start or quit the Bitcoin client can be &#039;&#039;tedious&#039;&#039; (and outright error-prone). If you want to keep your wallet encrypted (except while you&#039;re actually running the Bitcoin client), it&#039;s better to relegate the automation to a [http://lorelei.kaverit.org/bitcoin.sh small shell script] that handles the en/decryption and starting up Bitcoin client for you (Linux and OSX). &lt;br /&gt;
&lt;br /&gt;
There is also a method to Print out and encrypt your Wallet.dat as a special barcode. See details here: [[WalletPaperbackup]]&lt;br /&gt;
&lt;br /&gt;
==== Password Strength ====&lt;br /&gt;
Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is &#039;&#039;&#039;at least&#039;&#039;&#039; 12 characters long.  You can also use a multi-word password. [http://www.baekdal.com/tips/password-security-usability The Usability of Passwords] &lt;br /&gt;
&lt;br /&gt;
However, simply using dictionary words is also insecure as it opens you up to a dictionary attack. If you use dictionary words, be sure to throw random symbols and numbers in the mix as well.&lt;br /&gt;
&lt;br /&gt;
A good way to create secure but easy-to-remember passwords is to pick a password (ex: d0g) and pad it with a good number of repeated characters afterward (such as 10 $ signs - so d0g becomes d0g$$$$$$$$$$) - this is just as cryptographically secure as a random password of equal length so long as the attacker does not know which symbol you are following your &amp;quot;word&amp;quot; with and how many times it is repeated. ([https://www.grc.com/haystack.htm source])&lt;br /&gt;
&lt;br /&gt;
If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.&lt;br /&gt;
&lt;br /&gt;
Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.&lt;br /&gt;
&lt;br /&gt;
===== Choosing Your Password =====&lt;br /&gt;
Make sure you pick at least one character in each group:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Lowercase: abcdefghijklmnopqrstuvwxyz&lt;br /&gt;
  Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;br /&gt;
  Number: 1234567890&lt;br /&gt;
  Symbol: `~!@#$%^&amp;amp;*()-_=+\|[{]};:&#039;&amp;quot;,&amp;lt;.&amp;gt;/? (space)&lt;br /&gt;
  &lt;br /&gt;
  09 char = insecure&lt;br /&gt;
  10 char = low security&lt;br /&gt;
  11 char = medium security&lt;br /&gt;
  12 char = good security (good enough for your wallet)&lt;br /&gt;
  13 char = v.good enough for anything.&lt;br /&gt;
&lt;br /&gt;
==== Storage of Archive ====&lt;br /&gt;
One of the most simple methods for storing a appropriately &#039;&#039;&#039;encrypted&#039;&#039;&#039; archive of your wallet.dat file is to send the archive as an email attachment to your own e-mail address.  Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely.  One can even obfuscate the name of the files within the archive, and name the archive something less inviting, such as: &#039;personal notes&#039; or &#039;car insurance&#039;.&lt;br /&gt;
&lt;br /&gt;
Another solution is to use a file storage service like [http://www.wuala.com/bitcoin Wuala] ( encrypted, [http://www.bitcoin.org/smf/index.php?topic=5817.0 instructions]), [http://www.dropbox.com Dropbox] and [http://en.wikipedia.org/wiki/Comparison_of_online_backup_services others], including the more secure [http://www.spideroak.com SpiderOak].&lt;br /&gt;
&lt;br /&gt;
=== Linux solution ===&lt;br /&gt;
&lt;br /&gt;
Linux users can setup backups using cron by telling it to run a backup script at set intervals of time. Run &#039;crontab -e&#039; and add this line near the bottom:&lt;br /&gt;
&lt;br /&gt;
 01 */1 * * * /usr/local/bin/backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
This cron line will run the /usr/local/bin/backupwallet.sh script at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won&#039;t run. You may also wish to ignore the script&#039;s output by appending &amp;quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&amp;quot; to the line (this will also prevent emails from being sent).&lt;br /&gt;
&lt;br /&gt;
Create /usr/local/bin/backupwallet.sh:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # /usr/local/bin/backupwallet.sh&lt;br /&gt;
 #&lt;br /&gt;
 # Performs backup of bitcoin wallet.&lt;br /&gt;
 #&lt;br /&gt;
 # Written by: https://en.bitcoin.it/wiki/Securing_your_wallet&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Standard Options&lt;br /&gt;
 #&lt;br /&gt;
 TS=$(date &amp;quot;+%Y%m%d-%H%M&amp;quot;)&lt;br /&gt;
 WALLET=/tmp/wallet-${TS}&lt;br /&gt;
 WALLET_E=/tmp/wallet-${TS}.crypt&lt;br /&gt;
 BITCOIN=bitcoind  # /path/to/bitcoind&lt;br /&gt;
 GPG=gpg  # /path/to/gpg&lt;br /&gt;
 GPG_USER=username  # Username of gpg recipient. User should have gpg setup.&lt;br /&gt;
 RM=rm&lt;br /&gt;
 RM_OPTS=&#039;--force&#039;&lt;br /&gt;
 USE_SHRED=0  # Flip to 1 to use `shred` instead of `rm`.&lt;br /&gt;
 SHRED=shred&lt;br /&gt;
 SHRED_OPTS=&#039;--force --iterations=9 --zero --remove&#039;&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Storage Options&lt;br /&gt;
 # Only 1 set of options should be un-commented (the last one will be used).&lt;br /&gt;
 # Update CP_DEST paths as neccessary.&lt;br /&gt;
 #&lt;br /&gt;
 # CP - Storage on a local machine. Could be Dropbox/Wuala folder.&lt;br /&gt;
 #CP=cp&lt;br /&gt;
 #CP_DEST=&#039;/var/data/backups/&#039;  # &#039;~/Dropbox/&#039;, etc.&lt;br /&gt;
 #&lt;br /&gt;
 # SSH - Storage on a remote machine.&lt;br /&gt;
 CP=scp&lt;br /&gt;
 CP_DEST=&#039;remoteuser@example.com:~/wallets/&#039;&lt;br /&gt;
 #&lt;br /&gt;
 # S3 - Storage on Amazon&#039;s S3. Be sure s3cmd is installed and properly setup.&lt;br /&gt;
 # You may need &amp;quot;s3cmd put --force&amp;quot; if you use a sub-directory in CP_DEST.&lt;br /&gt;
 #CP=s3cmd put&lt;br /&gt;
 #CP_DEST=&#039;s3://bucket&#039;&lt;br /&gt;
 &lt;br /&gt;
 do_clean() {&lt;br /&gt;
   # Remove temporary wallets.&lt;br /&gt;
   if [ 1 -eq $USE_SHRED ]; then&lt;br /&gt;
     $SHRED $SHRED_OPTS $WALLET $WALLET_E&lt;br /&gt;
   else&lt;br /&gt;
     $RM $RM_OPTS $WALLET $WALLET_E&lt;br /&gt;
   fi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 do_fail() {&lt;br /&gt;
   do_clean&lt;br /&gt;
   echo failed!&lt;br /&gt;
   exit 1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # Perform the backup.&lt;br /&gt;
 echo -n Making backup...&lt;br /&gt;
 $BITCOIN backupwallet $WALLET&lt;br /&gt;
 [ ! -s &amp;quot;$WALLET&amp;quot; ] &amp;amp;&amp;amp; do_fail  # If the backup does not exist or is empty, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Encrypting backup...&lt;br /&gt;
 $GPG -r $GPG_USER --output $WALLET_E --encrypt $WALLET&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If gpg returns a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Copying to backup location...&lt;br /&gt;
 $CP $WALLET_E &amp;quot;$CP_DEST&amp;quot;&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If the $CP command returns a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 do_clean&lt;br /&gt;
 &lt;br /&gt;
 exit 0&lt;br /&gt;
&lt;br /&gt;
The shell script:&lt;br /&gt;
&lt;br /&gt;
* Calls bitcoind backupwallet to create a time/date-stamped wallet.&lt;br /&gt;
* GPG encrypts the wallet with your public key.&lt;br /&gt;
* Copies the result using one of several storage options (cp, scp, and s3cmd).&lt;br /&gt;
* Uses the rm or shred command to remove the temporary wallet files.&lt;br /&gt;
&lt;br /&gt;
Be sure to modify the script options to fit your setup. After you save, make sure the file can be executed properly by the cron user. Common permissions for files in /usr/local/bin/ can be applied using (verify with your distribution!):&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/bin/ &amp;amp;&amp;amp; chown root:root backupwallet.sh &amp;amp;&amp;amp; chmod 755 backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
&lt;br /&gt;
==Restore==&lt;br /&gt;
&lt;br /&gt;
Assuming your backup is recent enough that you haven&#039;t used up all of your key pool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:&lt;br /&gt;
* Quit bitcoin(d).&lt;br /&gt;
* Copy your backed up wallet.dat into your bitcoin profile directory.&lt;br /&gt;
* If copying into existing profile, delete file &#039;&#039;blkindex.dat&#039;&#039; and &#039;&#039;blk0001.dat&#039;&#039; to make the client re-scan the block chain.&lt;br /&gt;
And you&#039;ll be good as new.&lt;br /&gt;
&lt;br /&gt;
==Erasing Plain Text Wallets==&lt;br /&gt;
&lt;br /&gt;
A good practice is to keep at least two wallets, one as a &amp;quot;current account&amp;quot; for everyday transactions and one as a &amp;quot;savings account&amp;quot; where you store the majority of your Bitcoins.  &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;savings account&amp;quot; wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your &amp;quot;current account&amp;quot; wallet.&lt;br /&gt;
&lt;br /&gt;
In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will &#039;&#039;not&#039;&#039; generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.&lt;br /&gt;
&lt;br /&gt;
The Linux &#039;&#039;&#039;shred&#039;&#039;&#039; command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover.  Using shred (and similar tools on Windows) however does not guarantee that still other copies don&#039;t exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your  filesystem, duplicating your wallet.dat.&lt;br /&gt;
&lt;br /&gt;
In Mac OS, the equivalent of &#039;&#039;&#039;shred&#039;&#039;&#039; is &#039;&#039;&#039;srm&#039;&#039;&#039; (introduced in Leopard). Using the Finder to remove files, clicking &amp;quot;Secure Empty Trash&amp;quot; in the Finder menu will shred the contents of the trash can. As with any OS this doesn&#039;t guarantee that there are not other copies elsewhere on your system.&lt;br /&gt;
&lt;br /&gt;
For Windows, the built-in command &#039;&#039;cipher /W&#039;&#039; will shred all previously-deleted files. [http://www.cylog.org/utilities/cybershredder.jsp CyberShredder] can securely deleted individual files.&lt;br /&gt;
&lt;br /&gt;
==eWallet==&lt;br /&gt;
&lt;br /&gt;
Storing bitcoins with an [[eWallet]] provider incurs risks as well. Basically you grant the third party, in this case eWallet, full access to your wallet.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Data directory]]&lt;br /&gt;
* [http://startbitcoin.com/how-to-create-a-secure-bitcoin-wallet/ Secure Bitcoin Wallet Tutorial]&lt;br /&gt;
* [[How to set up a secure offline savings wallet]]&lt;br /&gt;
&lt;br /&gt;
[[de:Sichere deine Geldbörse]]&lt;br /&gt;
[[zh-cn:保护你的钱包]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12260</id>
		<title>Securing your wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12260"/>
		<updated>2011-07-02T08:34:59Z</updated>

		<summary type="html">&lt;p&gt;D-man97: /* Linux solution */ Final&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Wallet security can be broken down into two independent goals:&lt;br /&gt;
# Protecting your wallet against loss.&lt;br /&gt;
# Protecting your wallet against theft.&lt;br /&gt;
&lt;br /&gt;
In the case that your current wallet hasn&#039;t been protected adequately (e.g. put online with a weaker password):&lt;br /&gt;
# Making a new secure wallet, using appropriate long-term protection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For a brief overview see also: [[Wallet Security Dos and Don&#039;ts (Windows)|Wallet Security Dos and Don&#039;ts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Technical Background==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions send Bitcoins to a specific public key. A Bitcoin address is an encoded hash of a public key. In order to use received Bitcoins, you need to have the private key matching the public key you received with. This is sort of like a super long password associated with an account (public key). Your Bitcoin wallet contains all of the private keys necessary for spending your received transactions. If you delete your wallet without a backup, then you no longer have the authorization information necessary to claim your coins, and the coins associated with those keys are lost forever.&lt;br /&gt;
&lt;br /&gt;
The wallet contains a pool of queued keys. By default there are 100 keys in the [[key pool]].  The size of the pool is configurable using the &amp;quot;-keypool&amp;quot; command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.&lt;br /&gt;
&lt;br /&gt;
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.&lt;br /&gt;
&lt;br /&gt;
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient&#039;s public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.&lt;br /&gt;
&lt;br /&gt;
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.&lt;br /&gt;
&lt;br /&gt;
== Making a new wallet ==&lt;br /&gt;
&lt;br /&gt;
In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.&lt;br /&gt;
&lt;br /&gt;
For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised.  Just re-encrypting isn&#039;t secure.  One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).&lt;br /&gt;
&lt;br /&gt;
==Making a secure workspace==&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
The first step is to make a [http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/ new user,] so run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser new_user_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as root. When you get to the prompt &#039;Enter the new value, or press ENTER for the default&#039;, just keep hitting ENTER.&lt;br /&gt;
&lt;br /&gt;
Then switch user to the new user.  To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the &#039;System/Quit&#039; screen, or if there is no switch icon on your system you can log out and log back in as the new user.  Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.&lt;br /&gt;
&lt;br /&gt;
For secure browsing, open Firefox, and then go into the Edit menu and click Preferences.  Starting from the left, click on the General tab, and in the &#039;Startup/When Firefox starts&#039; pop up menu, choose &#039;Show a Blank Page&#039;.  Then click on the Content tab, and deselect &#039;Load images automatically&#039; and deselect &#039;Enable Javascript&#039;.  Then click on the Privacy tab, and in the &#039;History/Firefox will&#039; pop up menu, choose &#039;Never remember history&#039;.  Then click on the Security tab, and in the Passwords section, deselect &#039;Remember passwords for sites&#039; and deselect &#039;Use a master password&#039;.  Then click on the Advanced tab, then click on the Update tab, and then in the &#039;Automatically check for updates to&#039; section, deselect &#039;Add-ons&#039; and &#039;Search Engines&#039;.&lt;br /&gt;
&lt;br /&gt;
When javascript is disabled, the [http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.23/bitcoin-0.3.23-linux.tar.gz/download linux download page] will not download automatically, so you&#039;ll have to click on the &#039;direct link&#039; part of the &amp;quot;Problems with the download? Please use this &#039;direct link&#039; or try another mirror.&amp;quot; line.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve made your secure new user, to maintain security you should use it only for bitcoin.&lt;br /&gt;
&lt;br /&gt;
It&#039;s also a good idea to encrypt the Home directory of whatever user you run Bitcoin under using ecryptfs-utils. To do this:&lt;br /&gt;
# If the Home directory is not empty you should back it up first, by just copying the data to an external drive or something.&lt;br /&gt;
# install ecryptfs-utils (on Ubuntu: sudo apt-get install ecryptfs-utils)&lt;br /&gt;
# log out of X (graphical system) and press Ctrl+Alt+F1 to login to the command shell (you must be logged out or some files will be open and the tool won&#039;t be able to encrypt your data)&lt;br /&gt;
# change directory to something that&#039;s not in your home folder (ex: cd / )&lt;br /&gt;
# run the migration tool (on Ubuntu: sudo ecryptfs-migrate-home -u username)&lt;br /&gt;
# if it&#039;s successful, you can now press ALT+F8 to go back to the GUI and login&lt;br /&gt;
# run &#039;ecryptfs-unwrap-passphrase&#039; and &#039;&#039;&#039;WRITE DOWN OR SAVE THE CODE IT RETURNS&#039;&#039;&#039; because you will need it if you ever have to pull your data off while the OS is not working. (You can run it again later if you need to, but run it now so that you can get your data if your Linux install gets botched.)&lt;br /&gt;
# run &#039;ecryptfs-setup-swap&#039; to encrypt your swap partition (the encrypted folder data is not encrypted while it&#039;s in memory, and so if it&#039;s ever sent to the swap partition it can be stolen from there unless that too is encrypted - be aware that this will mean you cannot use Hibernate anymore, as the bootloader won&#039;t be able to restore the hibernation data)&lt;br /&gt;
(instructions from [http://bodhizazen.net/Tutorials/Ecryptfs/#Migrate])&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
=====Backup all data (500MB)=====&lt;br /&gt;
Follow these instructions to backup all the bitcoin data (wallet and block chains) to an encrypted disk image.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 500MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move everything from ~/Library/Application Support/Bitcoin/ to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin ~/Library/Application Support/Bitcoin&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
=====Backup just wallet.dat (40MB)=====&lt;br /&gt;
Follow these instructions to backup just the wallet.dat file. This results in a smaller disk image, but it&#039;s more complicated to do.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 40MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move your wallet.dat file to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin/wallet.dat ~/Library/Application Support/Bitcoin/wallet.dat&lt;br /&gt;
&lt;br /&gt;
[[File:MountWalletAndLauchnBitcoin_OSX_Automator.png|thumbnail|150px|Mount Wallet and launch Bitcoin]]&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you start the Bitcoin application without having the image mounted, the application will overwrite your symlink with a new wallet. If that happens, don&#039;t panic. Just delete the new wallet.dat, mount the image, and recreate the symlink like above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Automation&#039;&#039;&#039;: You can create a small application using [http://en.wikipedia.org/wiki/Automator_%28software%29 Automator] (included in OS X) to automatically mount the wallet and then launch Bitcoin App. See the Screenshot on how to do this.&lt;br /&gt;
&lt;br /&gt;
If one &#039;&#039;doesn&#039;t&#039;&#039; want to use encrypted Disk images, then a &#039;&#039;&#039;small shell script&#039;&#039;&#039; can be used instead that takes care of decrypting the wallet, launching bitcoin client, and encrypting it after the client exits. This script works on both OSX and Linux: [http://lorelei.kaverit.org/bitcoin.sh bitcoin-launch-script]&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
If you are using Windows XP or Windows 7, you can keep your wallet on an encrypted disk image created by third-party software, such as [http://www.truecrypt.org/ TrueCrypt] (open source) or [http://www.jetico.com/encryption-bestcrypt/ Jetico BestCrypt] (commercial).  You can probably do the same with Windows Vista or Windows 2000.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You should configure BitCoin in this manner only on computers where you use BitCoin, but do not use that computer to mine.  For example, this is a good configuration for a notebook or tablet computer.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have installed the Windows BitCoin client and run it at least once, the process is described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;To mount the BitCoin data directory on an encrypted drive&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol start=1 type=1&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the third-party disk image encryption program of your choice to create and mount an encrypted disk image of at least 100 MB in size.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Locate the BitCoin data directory, and copy the directory with all contents to the encrypted drive.&lt;br /&gt;
&amp;lt;p&amp;gt;For help finding this directory, see &amp;lt;b&amp;gt;[[Securing_your_wallet#Locating_BitCoin_s_data_directory|Locating BitCoin&#039;s Data Directory]]&amp;lt;/b&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a Windows shortcut that starts BitCoin with the &amp;lt;code&amp;gt;-datadir&amp;lt;/code&amp;gt; parameter and specifies the encrypted drive and directory.&lt;br /&gt;
&amp;lt;p&amp;gt;For example, if you installed Bitcoin in the default directory, mounted your BitCoin encrypted drive as &amp;lt;code&amp;gt;E:\&amp;lt;/code&amp;gt;, and stored your BitCoin data directory on it as &amp;lt;code&amp;gt;Bitcoin&amp;lt;/code&amp;gt;, you would type the following command as the shortcut Target:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;C:\Program Files\Bitcoin\bitcoin.exe -datadir=E:\Bitcoin&amp;lt;/code&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open BitCoin&#039;s settings and configure it &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; to start automatically when you start Windows.&lt;br /&gt;
&amp;lt;p&amp;gt;This is to allow you to mount the BitCoin encrypted disk image before starting BitCoin.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Shut down BitCoin, and then restart it from the new shortcut.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After doing this, any time you want to use BitCoin, you must first mount the BitCoin encrypted disk image using the same drive designation, and then run BitCoin from the shortcut that you created, so that it can find its data and your wallet. :-)&lt;br /&gt;
&lt;br /&gt;
== Locating BitCoin&#039;s data directory ==&lt;br /&gt;
&lt;br /&gt;
The [[data directory]] is the location where Bitcoin&#039;s data files are stored, including the wallet data file.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
Go to Start -&amp;gt; Run (or press WinKey+R) and run this:&lt;br /&gt;
&lt;br /&gt;
 explorer %APPDATA%\BitCoin&lt;br /&gt;
&lt;br /&gt;
BitCoin&#039;s data folder will open. For most users, this is the following locations:&lt;br /&gt;
&lt;br /&gt;
 C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)&lt;br /&gt;
 &lt;br /&gt;
 C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;AppData&amp;quot; and &amp;quot;Application data&amp;quot; are hidden by default.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/.bitcoin/&lt;br /&gt;
&lt;br /&gt;
You need to do a &amp;quot;ls -a&amp;quot; to see directories that start with a dot.&lt;br /&gt;
&lt;br /&gt;
If that&#039;s not it, you can do a search like this:&lt;br /&gt;
&lt;br /&gt;
 find / -name wallet.dat -print 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/Library/Application Support/Bitcoin/&lt;br /&gt;
&lt;br /&gt;
==Backup==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: I would strongly recommend against using Dropbox to back up your Bitcoin data due to [http://en.wikipedia.org/wiki/Dropbox_(service)#Criticism security concerns] such as:&lt;br /&gt;
# the fact that they store your encryption key (meaning that a disgruntled Dropbox employee or an attacker who gained access to the system could decrypt your Dropbox data and steal your Bitcoins)&lt;br /&gt;
# the fact that the Dropbox client only needs a password for the first login. After it authenticates once, the server assigns it a token which it uses to show that, at one time, its user knew the password rather than sending the actual password (meaning that if you ever use the Dropbox client on another PC, that PC&#039;s users can access your Dropbox - even if you change your password - and can steal your Bitcoins or get a virus that will steal your Bitcoins).&lt;br /&gt;
&lt;br /&gt;
For these reasons, I personally prefer to use Wuala, which does not store your encryption key and requires a password each time (the client can be set to remember your password, but the server will check each time to make sure that the client is sending the correct password). Like Dropbox, the basic, lowest-storage-space account with Wuala is free of charge, and coincidentally, Wuala [http://www.wuala.com/en/bitcoin is experimenting with allowing users to pay for &amp;quot;upgraded&amp;quot; plans using Bitcoin.]&lt;br /&gt;
&lt;br /&gt;
In fact, whether you use Dropbox as your backup or not, use what Steve Gibson calls &amp;quot;pre-Internet encryption&amp;quot; (which he actually [http://itknowledgeexchange.techtarget.com/security-corner/cloud-security-and-privacy-do-they-exist/ discussed in the context of Dropbox&#039;s security concerns]) and use some form of encryption on the files before you back them up, just in case someone other than yourself ever gains access to that backup. Make sure to pick a password that&#039;s memorable but secure.&lt;br /&gt;
&lt;br /&gt;
The only file you need to back up is &amp;quot;wallet.dat&amp;quot;. Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.&lt;br /&gt;
&lt;br /&gt;
You can use the [[api|backupwallet]] JSON-RPC command to back up without shutting down Bitcoin.&lt;br /&gt;
&lt;br /&gt;
=== General Solutions ===&lt;br /&gt;
&lt;br /&gt;
Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.&lt;br /&gt;
* [http://www.7-zip.org/ 7-zip] - Supports strongly-encrypted archives.&lt;br /&gt;
* [http://www.axantum.com/axcrypt/ AxCrypt]&lt;br /&gt;
* [http://lrzip.kolivas.org lrzip] - Compression software for Linux and OSX that supports very high grade password protected encryption&lt;br /&gt;
* [http://www.truecrypt.org/ TrueCrypt] - Volume-based on-the-fly encryption (for advanced users)&lt;br /&gt;
* [http://www.rarlab.com/ WinRar] - Commonly used archive software that supports verification records and encryption.&lt;br /&gt;
&lt;br /&gt;
There is also a list of [[OpenSourceEncryptionSoftware|open source encryption software.]]&lt;br /&gt;
&lt;br /&gt;
Decrypting and encrypting the wallet.dat every time you start or quit the Bitcoin client can be &#039;&#039;tedious&#039;&#039; (and outright error-prone). If you want to keep your wallet encrypted (except while you&#039;re actually running the Bitcoin client), it&#039;s better to relegate the automation to a [http://lorelei.kaverit.org/bitcoin.sh small shell script] that handles the en/decryption and starting up Bitcoin client for you (Linux and OSX). &lt;br /&gt;
&lt;br /&gt;
There is also a method to Print out and encrypt your Wallet.dat as a special barcode. See details here: [[WalletPaperbackup]]&lt;br /&gt;
&lt;br /&gt;
==== Password Strength ====&lt;br /&gt;
Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is &#039;&#039;&#039;at least&#039;&#039;&#039; 12 characters long.  You can also use a multi-word password. [http://www.baekdal.com/tips/password-security-usability The Usability of Passwords] &lt;br /&gt;
&lt;br /&gt;
However, simply using dictionary words is also insecure as it opens you up to a dictionary attack. If you use dictionary words, be sure to throw random symbols and numbers in the mix as well.&lt;br /&gt;
&lt;br /&gt;
A good way to create secure but easy-to-remember passwords is to pick a password (ex: d0g) and pad it with a good number of repeated characters afterward (such as 10 $ signs - so d0g becomes d0g$$$$$$$$$$) - this is just as cryptographically secure as a random password of equal length so long as the attacker does not know which symbol you are following your &amp;quot;word&amp;quot; with and how many times it is repeated. ([https://www.grc.com/haystack.htm source])&lt;br /&gt;
&lt;br /&gt;
If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.&lt;br /&gt;
&lt;br /&gt;
Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.&lt;br /&gt;
&lt;br /&gt;
===== Choosing Your Password =====&lt;br /&gt;
Make sure you pick at least one character in each group:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Lowercase: abcdefghijklmnopqrstuvwxyz&lt;br /&gt;
  Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;br /&gt;
  Number: 1234567890&lt;br /&gt;
  Symbol: `~!@#$%^&amp;amp;*()-_=+\|[{]};:&#039;&amp;quot;,&amp;lt;.&amp;gt;/? (space)&lt;br /&gt;
  &lt;br /&gt;
  09 char = insecure&lt;br /&gt;
  10 char = low security&lt;br /&gt;
  11 char = medium security&lt;br /&gt;
  12 char = good security (good enough for your wallet)&lt;br /&gt;
  13 char = v.good enough for anything.&lt;br /&gt;
&lt;br /&gt;
==== Storage of Archive ====&lt;br /&gt;
One of the most simple methods for storing a appropriately &#039;&#039;&#039;encrypted&#039;&#039;&#039; archive of your wallet.dat file is to send the archive as an email attachment to your own e-mail address.  Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely.  One can even obfuscate the name of the files within the archive, and name the archive something less inviting, such as: &#039;personal notes&#039; or &#039;car insurance&#039;.&lt;br /&gt;
&lt;br /&gt;
Another solution is to use a file storage service like [http://www.wuala.com/bitcoin Wuala] ( encrypted, [http://www.bitcoin.org/smf/index.php?topic=5817.0 instructions]), [http://www.dropbox.com Dropbox] and [http://en.wikipedia.org/wiki/Comparison_of_online_backup_services others], including the more secure [http://www.spideroak.com SpiderOak].&lt;br /&gt;
&lt;br /&gt;
=== Linux solution ===&lt;br /&gt;
&lt;br /&gt;
Linux users can setup backups using cron by telling it to run a backup script at set intervals of time. Run &#039;crontab -e&#039; and add this line near the bottom:&lt;br /&gt;
&lt;br /&gt;
 01 */1 * * * /usr/local/bin/backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
This cron line will run the /usr/local/bin/backupwallet.sh script at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won&#039;t run. You may also wish to ignore the script&#039;s output by appending &amp;quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&amp;quot; to the line (this will also prevent emails from being sent).&lt;br /&gt;
&lt;br /&gt;
Create /usr/local/bin/backupwallet.sh:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # /usr/local/bin/backupwallet.sh&lt;br /&gt;
 #&lt;br /&gt;
 # Performs backup of bitcoin wallet.&lt;br /&gt;
 #&lt;br /&gt;
 # Written by: https://en.bitcoin.it/wiki/Securing_your_wallet&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Standard Options&lt;br /&gt;
 #&lt;br /&gt;
 TS=$(date &amp;quot;+%Y%m%d-%H%M&amp;quot;)&lt;br /&gt;
 WALLET=/tmp/wallet-${TS}&lt;br /&gt;
 WALLET_E=/tmp/wallet-${TS}.crypt&lt;br /&gt;
 BITCOIN=bitcoind  # /path/to/bitcoind&lt;br /&gt;
 GPG=gpg  # /path/to/gpg&lt;br /&gt;
 GPG_USER=username  # Username of gpg recipient. User should have gpg setup.&lt;br /&gt;
 RM=rm&lt;br /&gt;
 RM_OPTS=&#039;--force&#039;&lt;br /&gt;
 USE_SHRED=0  # Flip to 1 to use `shred` instead of `rm`.&lt;br /&gt;
 SHRED=shred&lt;br /&gt;
 SHRED_OPTS=&#039;--force --iterations=9 --zero --remove&#039;&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Storage Options&lt;br /&gt;
 # Only 1 set of options should be un-commented (the last one will be used).&lt;br /&gt;
 # Update CP_DEST paths as neccessary.&lt;br /&gt;
 #&lt;br /&gt;
 # CP - Storage on a local machine. Could be Dropbox/Wuala folder.&lt;br /&gt;
 #CP=cp&lt;br /&gt;
 #CP_DEST=&#039;/var/data/backups/&#039;  # &#039;~/Dropbox/&#039;, etc.&lt;br /&gt;
 #&lt;br /&gt;
 # SSH - Storage on a remote machine.&lt;br /&gt;
 CP=scp&lt;br /&gt;
 CP_DEST=&#039;remoteuser@example.com:~/wallets/&#039;&lt;br /&gt;
 #&lt;br /&gt;
 # S3 - Storage on Amazon&#039;s S3. Be sure s3cmd is installed and properly setup.&lt;br /&gt;
 # You may need &amp;quot;s3cmd put --force&amp;quot; if you use a sub-directory in CP_DEST.&lt;br /&gt;
 #CP=s3cmd put&lt;br /&gt;
 #CP_DEST=&#039;s3://bucket&#039;&lt;br /&gt;
 &lt;br /&gt;
 do_clean() {&lt;br /&gt;
   # Remove temporary wallets.&lt;br /&gt;
   if [ 1 -eq $USE_SHRED ]; then&lt;br /&gt;
     $SHRED $SHRED_OPTS $WALLET $WALLET_E&lt;br /&gt;
   else&lt;br /&gt;
     $RM $RM_OPTS $WALLET $WALLET_E&lt;br /&gt;
   fi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 do_fail() {&lt;br /&gt;
   do_clean&lt;br /&gt;
   echo failed!&lt;br /&gt;
   exit 1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # Perform the backup.&lt;br /&gt;
 echo -n Making backup...&lt;br /&gt;
 $BITCOIN backupwallet $WALLET&lt;br /&gt;
 [ ! -s &amp;quot;$WALLET&amp;quot; ] &amp;amp;&amp;amp; do_fail  # If the backup does not exist or is empty, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Encrypting backup....&lt;br /&gt;
 $GPG -r $GPG_USER --output $WALLET_E --encrypt $WALLET&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If gpg returns a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Copying to backup location...&lt;br /&gt;
 $CP $WALLET_E &amp;quot;$CP_DEST&amp;quot;&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If the $CP command returns a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 do_clean&lt;br /&gt;
 &lt;br /&gt;
 exit 0&lt;br /&gt;
&lt;br /&gt;
The shell script:&lt;br /&gt;
&lt;br /&gt;
* Calls bitcoind backupwallet to create a time/date-stamped wallet.&lt;br /&gt;
* GPG encrypts the wallet with your public key.&lt;br /&gt;
* Copies the result using one of several storage options (cp, scp, and s3cmd).&lt;br /&gt;
* Uses the rm or shred command to remove the temporary wallet files.&lt;br /&gt;
&lt;br /&gt;
Be sure to modify the script options to fit your setup. After you save, make sure the file can be executed properly by the cron user. Common permissions for files in /usr/local/bin/ can be applied using (verify with your distribution!):&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/bin/ &amp;amp;&amp;amp; chown root:root backupwallet.sh &amp;amp;&amp;amp; chmod 755 backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
&lt;br /&gt;
==Restore==&lt;br /&gt;
&lt;br /&gt;
Assuming your backup is recent enough that you haven&#039;t used up all of your key pool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:&lt;br /&gt;
* Quit bitcoin(d).&lt;br /&gt;
* Copy your backed up wallet.dat into your bitcoin profile directory.&lt;br /&gt;
* If copying into existing profile, delete file &#039;&#039;blkindex.dat&#039;&#039; and &#039;&#039;blk0001.dat&#039;&#039; to make the client re-scan the block chain.&lt;br /&gt;
And you&#039;ll be good as new.&lt;br /&gt;
&lt;br /&gt;
==Erasing Plain Text Wallets==&lt;br /&gt;
&lt;br /&gt;
A good practice is to keep at least two wallets, one as a &amp;quot;current account&amp;quot; for everyday transactions and one as a &amp;quot;savings account&amp;quot; where you store the majority of your Bitcoins.  &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;savings account&amp;quot; wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your &amp;quot;current account&amp;quot; wallet.&lt;br /&gt;
&lt;br /&gt;
In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will &#039;&#039;not&#039;&#039; generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.&lt;br /&gt;
&lt;br /&gt;
The Linux &#039;&#039;&#039;shred&#039;&#039;&#039; command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover.  Using shred (and similar tools on Windows) however does not guarantee that still other copies don&#039;t exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your  filesystem, duplicating your wallet.dat.&lt;br /&gt;
&lt;br /&gt;
In Mac OS, the equivalent of &#039;&#039;&#039;shred&#039;&#039;&#039; is &#039;&#039;&#039;srm&#039;&#039;&#039; (introduced in Leopard). Using the Finder to remove files, clicking &amp;quot;Secure Empty Trash&amp;quot; in the Finder menu will shred the contents of the trash can. As with any OS this doesn&#039;t guarantee that there are not other copies elsewhere on your system.&lt;br /&gt;
&lt;br /&gt;
For Windows, the built-in command &#039;&#039;cipher /W&#039;&#039; will shred all previously-deleted files. [http://www.cylog.org/utilities/cybershredder.jsp CyberShredder] can securely deleted individual files.&lt;br /&gt;
&lt;br /&gt;
==eWallet==&lt;br /&gt;
&lt;br /&gt;
Storing bitcoins with an [[eWallet]] provider incurs risks as well. Basically you grant the third party, in this case eWallet, full access to your wallet.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Data directory]]&lt;br /&gt;
* [http://startbitcoin.com/how-to-create-a-secure-bitcoin-wallet/ Secure Bitcoin Wallet Tutorial]&lt;br /&gt;
* [[How to set up a secure offline savings wallet]]&lt;br /&gt;
&lt;br /&gt;
[[de:Sichere deine Geldbörse]]&lt;br /&gt;
[[zh-cn:保护你的钱包]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12233</id>
		<title>Securing your wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12233"/>
		<updated>2011-07-02T01:18:14Z</updated>

		<summary type="html">&lt;p&gt;D-man97: /* Linux solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Wallet security can be broken down into two independent goals:&lt;br /&gt;
# Protecting your wallet against loss.&lt;br /&gt;
# Protecting your wallet against theft.&lt;br /&gt;
&lt;br /&gt;
In the case that your current wallet hasn&#039;t been protected adequately (e.g. put online with a weaker password):&lt;br /&gt;
# Making a new secure wallet, using appropriate long-term protection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For a brief overview see also: [[Wallet Security Dos and Don&#039;ts (Windows)|Wallet Security Dos and Don&#039;ts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Technical Background==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions send Bitcoins to a specific public key. A Bitcoin address is an encoded hash of a public key. In order to use received Bitcoins, you need to have the private key matching the public key you received with. This is sort of like a super long password associated with an account (public key). Your Bitcoin wallet contains all of the private keys necessary for spending your received transactions. If you delete your wallet without a backup, then you no longer have the authorization information necessary to claim your coins, and the coins associated with those keys are lost forever.&lt;br /&gt;
&lt;br /&gt;
The wallet contains a pool of queued keys. By default there are 100 keys in the [[key pool]].  The size of the pool is configurable using the &amp;quot;-keypool&amp;quot; command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.&lt;br /&gt;
&lt;br /&gt;
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.&lt;br /&gt;
&lt;br /&gt;
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient&#039;s public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.&lt;br /&gt;
&lt;br /&gt;
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.&lt;br /&gt;
&lt;br /&gt;
== Making a new wallet ==&lt;br /&gt;
&lt;br /&gt;
In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.&lt;br /&gt;
&lt;br /&gt;
For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised.  Just re-encrypting isn&#039;t secure.  One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).&lt;br /&gt;
&lt;br /&gt;
==Making a secure workspace==&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
The first step is to make a [http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/ new user,] so run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser new_user_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as root. When you get to the prompt &#039;Enter the new value, or press ENTER for the default&#039;, just keep hitting ENTER.&lt;br /&gt;
&lt;br /&gt;
Then switch user to the new user.  To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the &#039;System/Quit&#039; screen, or if there is no switch icon on your system you can log out and log back in as the new user.  Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.&lt;br /&gt;
&lt;br /&gt;
For secure browsing, open Firefox, and then go into the Edit menu and click Preferences.  Starting from the left, click on the General tab, and in the &#039;Startup/When Firefox starts&#039; pop up menu, choose &#039;Show a Blank Page&#039;.  Then click on the Content tab, and deselect &#039;Load images automatically&#039; and deselect &#039;Enable Javascript&#039;.  Then click on the Privacy tab, and in the &#039;History/Firefox will&#039; pop up menu, choose &#039;Never remember history&#039;.  Then click on the Security tab, and in the Passwords section, deselect &#039;Remember passwords for sites&#039; and deselect &#039;Use a master password&#039;.  Then click on the Advanced tab, then click on the Update tab, and then in the &#039;Automatically check for updates to&#039; section, deselect &#039;Add-ons&#039; and &#039;Search Engines&#039;.&lt;br /&gt;
&lt;br /&gt;
When javascript is disabled, the [http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.23/bitcoin-0.3.23-linux.tar.gz/download linux download page] will not download automatically, so you&#039;ll have to click on the &#039;direct link&#039; part of the &amp;quot;Problems with the download? Please use this &#039;direct link&#039; or try another mirror.&amp;quot; line.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve made your secure new user, to maintain security you should use it only for bitcoin.&lt;br /&gt;
&lt;br /&gt;
It&#039;s also a good idea to encrypt the Home directory of whatever user you run Bitcoin under using ecryptfs-utils. To do this:&lt;br /&gt;
# If the Home directory is not empty you should back it up first, by just copying the data to an external drive or something.&lt;br /&gt;
# install ecryptfs-utils (on Ubuntu: sudo apt-get install ecryptfs-utils)&lt;br /&gt;
# log out of X (graphical system) and press Ctrl+Alt+F1 to login to the command shell (you must be logged out or some files will be open and the tool won&#039;t be able to encrypt your data)&lt;br /&gt;
# change directory to something that&#039;s not in your home folder (ex: cd / )&lt;br /&gt;
# run the migration tool (on Ubuntu: sudo ecryptfs-migrate-home -u username)&lt;br /&gt;
# if it&#039;s successful, you can now press ALT+F8 to go back to the GUI and login&lt;br /&gt;
# run &#039;ecryptfs-unwrap-passphrase&#039; and &#039;&#039;&#039;WRITE DOWN OR SAVE THE CODE IT RETURNS&#039;&#039;&#039; because you will need it if you ever have to pull your data off while the OS is not working. (You can run it again later if you need to, but run it now so that you can get your data if your Linux install gets botched.)&lt;br /&gt;
# run &#039;ecryptfs-setup-swap&#039; to encrypt your swap partition (the encrypted folder data is not encrypted while it&#039;s in memory, and so if it&#039;s ever sent to the swap partition it can be stolen from there unless that too is encrypted - be aware that this will mean you cannot use Hibernate anymore, as the bootloader won&#039;t be able to restore the hibernation data)&lt;br /&gt;
(instructions from [http://bodhizazen.net/Tutorials/Ecryptfs/#Migrate])&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
=====Backup all data (500MB)=====&lt;br /&gt;
Follow these instructions to backup all the bitcoin data (wallet and block chains) to an encrypted disk image.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 500MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move everything from ~/Library/Application Support/Bitcoin/ to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin ~/Library/Application Support/Bitcoin&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
=====Backup just wallet.dat (40MB)=====&lt;br /&gt;
Follow these instructions to backup just the wallet.dat file. This results in a smaller disk image, but it&#039;s more complicated to do.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 40MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move your wallet.dat file to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin/wallet.dat ~/Library/Application Support/Bitcoin/wallet.dat&lt;br /&gt;
&lt;br /&gt;
[[File:MountWalletAndLauchnBitcoin_OSX_Automator.png|thumbnail|150px|Mount Wallet and launch Bitcoin]]&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you start the Bitcoin application without having the image mounted, the application will overwrite your symlink with a new wallet. If that happens, don&#039;t panic. Just delete the new wallet.dat, mount the image, and recreate the symlink like above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Automation&#039;&#039;&#039;: You can create a small application using [http://en.wikipedia.org/wiki/Automator_%28software%29 Automator] (included in OS X) to automatically mount the wallet and then launch Bitcoin App. See the Screenshot on how to do this.&lt;br /&gt;
&lt;br /&gt;
If one &#039;&#039;doesn&#039;t&#039;&#039; want to use encrypted Disk images, then a &#039;&#039;&#039;small shell script&#039;&#039;&#039; can be used instead that takes care of decrypting the wallet, launching bitcoin client, and encrypting it after the client exits. This script works on both OSX and Linux: [http://lorelei.kaverit.org/bitcoin.sh bitcoin-launch-script]&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
If you are using Windows XP or Windows 7, you can keep your wallet on an encrypted disk image created by third-party software, such as [http://www.truecrypt.org/ TrueCrypt] (open source) or [http://www.jetico.com/encryption-bestcrypt/ Jetico BestCrypt] (commercial).  You can probably do the same with Windows Vista or Windows 2000.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You should configure BitCoin in this manner only on computers where you use BitCoin, but do not use that computer to mine.  For example, this is a good configuration for a notebook or tablet computer.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have installed the Windows BitCoin client and run it at least once, the process is described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;To mount the BitCoin data directory on an encrypted drive&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol start=1 type=1&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the third-party disk image encryption program of your choice to create and mount an encrypted disk image of at least 100 MB in size.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Locate the BitCoin data directory, and copy the directory with all contents to the encrypted drive.&lt;br /&gt;
&amp;lt;p&amp;gt;For help finding this directory, see &amp;lt;b&amp;gt;[[Securing_your_wallet#Locating_BitCoin_s_data_directory|Locating BitCoin&#039;s Data Directory]]&amp;lt;/b&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a Windows shortcut that starts BitCoin with the &amp;lt;code&amp;gt;-datadir&amp;lt;/code&amp;gt; parameter and specifies the encrypted drive and directory.&lt;br /&gt;
&amp;lt;p&amp;gt;For example, if you installed Bitcoin in the default directory, mounted your BitCoin encrypted drive as &amp;lt;code&amp;gt;E:\&amp;lt;/code&amp;gt;, and stored your BitCoin data directory on it as &amp;lt;code&amp;gt;Bitcoin&amp;lt;/code&amp;gt;, you would type the following command as the shortcut Target:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;C:\Program Files\Bitcoin\bitcoin.exe -datadir=E:\Bitcoin&amp;lt;/code&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open BitCoin&#039;s settings and configure it &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; to start automatically when you start Windows.&lt;br /&gt;
&amp;lt;p&amp;gt;This is to allow you to mount the BitCoin encrypted disk image before starting BitCoin.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Shut down BitCoin, and then restart it from the new shortcut.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After doing this, any time you want to use BitCoin, you must first mount the BitCoin encrypted disk image using the same drive designation, and then run BitCoin from the shortcut that you created, so that it can find its data and your wallet. :-)&lt;br /&gt;
&lt;br /&gt;
== Locating BitCoin&#039;s data directory ==&lt;br /&gt;
&lt;br /&gt;
The [[data directory]] is the location where Bitcoin&#039;s data files are stored, including the wallet data file.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
Go to Start -&amp;gt; Run (or press WinKey+R) and run this:&lt;br /&gt;
&lt;br /&gt;
 explorer %APPDATA%\BitCoin&lt;br /&gt;
&lt;br /&gt;
BitCoin&#039;s data folder will open. For most users, this is the following locations:&lt;br /&gt;
&lt;br /&gt;
 C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)&lt;br /&gt;
 &lt;br /&gt;
 C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;AppData&amp;quot; and &amp;quot;Application data&amp;quot; are hidden by default.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/.bitcoin/&lt;br /&gt;
&lt;br /&gt;
You need to do a &amp;quot;ls -a&amp;quot; to see directories that start with a dot.&lt;br /&gt;
&lt;br /&gt;
If that&#039;s not it, you can do a search like this:&lt;br /&gt;
&lt;br /&gt;
 find / -name wallet.dat -print 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/Library/Application Support/Bitcoin/&lt;br /&gt;
&lt;br /&gt;
==Backup==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: I would strongly recommend against using Dropbox to back up your Bitcoin data due to [http://en.wikipedia.org/wiki/Dropbox_(service)#Criticism security concerns] such as:&lt;br /&gt;
# the fact that they store your encryption key (meaning that a disgruntled Dropbox employee or an attacker who gained access to the system could decrypt your Dropbox data and steal your Bitcoins)&lt;br /&gt;
# the fact that the Dropbox client only needs a password for the first login. After it authenticates once, the server assigns it a token which it uses to show that, at one time, its user knew the password rather than sending the actual password (meaning that if you ever use the Dropbox client on another PC, that PC&#039;s users can access your Dropbox - even if you change your password - and can steal your Bitcoins or get a virus that will steal your Bitcoins).&lt;br /&gt;
&lt;br /&gt;
For these reasons, I personally prefer to use Wuala, which does not store your encryption key and requires a password each time (the client can be set to remember your password, but the server will check each time to make sure that the client is sending the correct password). Like Dropbox, the basic, lowest-storage-space account with Wuala is free of charge, and coincidentally, Wuala [http://www.wuala.com/en/bitcoin is experimenting with allowing users to pay for &amp;quot;upgraded&amp;quot; plans using Bitcoin.]&lt;br /&gt;
&lt;br /&gt;
In fact, whether you use Dropbox as your backup or not, use what Steve Gibson calls &amp;quot;pre-Internet encryption&amp;quot; (which he actually [http://itknowledgeexchange.techtarget.com/security-corner/cloud-security-and-privacy-do-they-exist/ discussed in the context of Dropbox&#039;s security concerns]) and use some form of encryption on the files before you back them up, just in case someone other than yourself ever gains access to that backup. Make sure to pick a password that&#039;s memorable but secure.&lt;br /&gt;
&lt;br /&gt;
The only file you need to back up is &amp;quot;wallet.dat&amp;quot;. Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.&lt;br /&gt;
&lt;br /&gt;
You can use the [[api|backupwallet]] JSON-RPC command to back up without shutting down Bitcoin.&lt;br /&gt;
&lt;br /&gt;
=== General Solutions ===&lt;br /&gt;
&lt;br /&gt;
Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.&lt;br /&gt;
* [http://www.7-zip.org/ 7-zip] - Supports strongly-encrypted archives.&lt;br /&gt;
* [http://www.axantum.com/axcrypt/ AxCrypt]&lt;br /&gt;
* [http://lrzip.kolivas.org lrzip] - Compression software for Linux and OSX that supports very high grade password protected encryption&lt;br /&gt;
* [http://www.truecrypt.org/ TrueCrypt] - Volume-based on-the-fly encryption (for advanced users)&lt;br /&gt;
* [http://www.rarlab.com/ WinRar] - Commonly used archive software that supports verification records and encryption.&lt;br /&gt;
&lt;br /&gt;
There is also a list of [[OpenSourceEncryptionSoftware|open source encryption software.]]&lt;br /&gt;
&lt;br /&gt;
Decrypting and encrypting the wallet.dat every time you start or quit the Bitcoin client can be &#039;&#039;tedious&#039;&#039; (and outright error-prone). If you want to keep your wallet encrypted (except while you&#039;re actually running the Bitcoin client), it&#039;s better to relegate the automation to a [http://lorelei.kaverit.org/bitcoin.sh small shell script] that handles the en/decryption and starting up Bitcoin client for you (Linux and OSX). &lt;br /&gt;
&lt;br /&gt;
There is also a method to Print out and encrypt your Wallet.dat as a special barcode. See details here: [[WalletPaperbackup]]&lt;br /&gt;
&lt;br /&gt;
==== Password Strength ====&lt;br /&gt;
Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is &#039;&#039;&#039;at least&#039;&#039;&#039; 12 characters long.  You can also use a multi-word password. [http://www.baekdal.com/tips/password-security-usability The Usability of Passwords] &lt;br /&gt;
&lt;br /&gt;
However, simply using dictionary words is also insecure as it opens you up to a dictionary attack. If you use dictionary words, be sure to throw random symbols and numbers in the mix as well.&lt;br /&gt;
&lt;br /&gt;
A good way to create secure but easy-to-remember passwords is to pick a password (ex: d0g) and pad it with a good number of repeated characters afterward (such as 10 $ signs - so d0g becomes d0g$$$$$$$$$$) - this is just as cryptographically secure as a random password of equal length so long as the attacker does not know which symbol you are following your &amp;quot;word&amp;quot; with and how many times it is repeated. ([https://www.grc.com/haystack.htm source])&lt;br /&gt;
&lt;br /&gt;
If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.&lt;br /&gt;
&lt;br /&gt;
Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.&lt;br /&gt;
&lt;br /&gt;
===== Choosing Your Password =====&lt;br /&gt;
Make sure you pick at least one character in each group:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Lowercase: abcdefghijklmnopqrstuvwxyz&lt;br /&gt;
  Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;br /&gt;
  Number: 1234567890&lt;br /&gt;
  Symbol: `~!@#$%^&amp;amp;*()-_=+\|[{]};:&#039;&amp;quot;,&amp;lt;.&amp;gt;/? (space)&lt;br /&gt;
  &lt;br /&gt;
  09 char = insecure&lt;br /&gt;
  10 char = low security&lt;br /&gt;
  11 char = medium security&lt;br /&gt;
  12 char = good security (good enough for your wallet)&lt;br /&gt;
  13 char = v.good enough for anything.&lt;br /&gt;
&lt;br /&gt;
==== Storage of Archive ====&lt;br /&gt;
One of the most simple methods for storing a appropriately &#039;&#039;&#039;encrypted&#039;&#039;&#039; archive of your wallet.dat file is to send the archive as an email attachment to your own e-mail address.  Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely.  One can even obfuscate the name of the files within the archive, and name the archive something less inviting, such as: &#039;personal notes&#039; or &#039;car insurance&#039;.&lt;br /&gt;
&lt;br /&gt;
Another solution is to use a file storage service like [http://www.wuala.com/bitcoin Wuala] ( encrypted, [http://www.bitcoin.org/smf/index.php?topic=5817.0 instructions]), [http://www.dropbox.com Dropbox] and [http://en.wikipedia.org/wiki/Comparison_of_online_backup_services others], including the more secure [http://www.spideroak.com SpiderOak].&lt;br /&gt;
&lt;br /&gt;
=== Linux solution ===&lt;br /&gt;
&lt;br /&gt;
Linux users can setup backups using cron by telling it to run a backup script at set intervals of time. Run &#039;crontab -e&#039; and add this line near the bottom:&lt;br /&gt;
&lt;br /&gt;
 01 */1 * * * /usr/local/bin/backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
This cron line will run the /usr/local/bin/backupwallet.sh script at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won&#039;t run. You may also wish to ignore the script&#039;s output by appending &amp;quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&amp;quot; to the line.&lt;br /&gt;
&lt;br /&gt;
Create backupwallet.sh:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # /usr/local/bin/backupwallet.sh&lt;br /&gt;
 #&lt;br /&gt;
 # Performs backup of bitcoin wallet.&lt;br /&gt;
 #&lt;br /&gt;
 # Written by: https://en.bitcoin.it/wiki/Securing_your_wallet&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Standard Options&lt;br /&gt;
 #&lt;br /&gt;
 TS=$(date &amp;quot;+%Y%m%d-%H%M&amp;quot;)&lt;br /&gt;
 WALLET=/tmp/wallet${TS}&lt;br /&gt;
 WALLET_E=/tmp/wallet${TS}.crypt&lt;br /&gt;
 USERNAME=username  # Update to your bitcoin Linux username.&lt;br /&gt;
 RM=rm&lt;br /&gt;
 RM_OPTS=--force&lt;br /&gt;
 USE_SHRED=0  # Flip to 1 to use `shred` instead of `rm`.&lt;br /&gt;
 SHRED=shred&lt;br /&gt;
 SHRED_OPTS=--force --iterations=9 --zero --remove&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Storage Options&lt;br /&gt;
 # Only 1 option should be un-commented (the last one will be used).&lt;br /&gt;
 # Update CP_DEST paths as neccessary.&lt;br /&gt;
 #&lt;br /&gt;
 # CP - Storage on a local (or networked) machine. Could be Dropbox/Wuala folder.&lt;br /&gt;
 #CP=cp&lt;br /&gt;
 #CP_DEST=smb://machine/share/folder/  # /var/data/backups/, ~/Dropbox/, etc.&lt;br /&gt;
 #&lt;br /&gt;
 # SSH - Storage on a remote machine.&lt;br /&gt;
 CP=scp&lt;br /&gt;
 CP_DEST=&amp;quot;remoteuser@example.com:~/wallets/&amp;quot;&lt;br /&gt;
 #&lt;br /&gt;
 # S3 - Storage on Amazon&#039;s S3. Be sure s3cmd is installed and properly setup.&lt;br /&gt;
 # You may need &amp;quot;s3cmd put --force&amp;quot; if you use a sub-directory in CP_DEST.&lt;br /&gt;
 #CP=s3cmd put&lt;br /&gt;
 #CP_DEST=s3://bucket&lt;br /&gt;
 &lt;br /&gt;
 do_clean() {&lt;br /&gt;
   # Remove temporary wallets.&lt;br /&gt;
   if [ 1 -eq $USE_SHRED ]; then&lt;br /&gt;
     $SHRED $SHRED_OPTS $WALLET $WALLET_E&lt;br /&gt;
   else&lt;br /&gt;
     $RM $RM_OPTS $WALLET $WALLET_E&lt;br /&gt;
   fi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 do_fail() {&lt;br /&gt;
   echo failed!&lt;br /&gt;
   do_clean&lt;br /&gt;
   exit 1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # Perform the backup.&lt;br /&gt;
 echo -n Making backup...&lt;br /&gt;
 bitcoind backupwallet $WALLET&lt;br /&gt;
 [ ! -s &amp;quot;$WALLET&amp;quot; ] &amp;amp;&amp;amp; do_fail  # If the backup does not exist or is empty, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Encrypting backup....&lt;br /&gt;
 gpg -r $USERNAME --output $WALLET_E --encrypt $WALLET&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If gpg returns a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Copying to backup location...&lt;br /&gt;
 $CP $WALLET_E $CP_DEST&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If the $CP command returns a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 do_clean&lt;br /&gt;
 &lt;br /&gt;
 exit 0&lt;br /&gt;
&lt;br /&gt;
The shell script:&lt;br /&gt;
&lt;br /&gt;
* Calls bitcoind backupwallet to create a time/date-stamped wallet.&lt;br /&gt;
* GPG encrypts the wallet with your public key.&lt;br /&gt;
* Copies the result using one of several storage options (cp, scp, and s3cmd).&lt;br /&gt;
* Uses the rm or shred command to remove the temporary wallet files.&lt;br /&gt;
&lt;br /&gt;
Be sure to modify the script options to fit your setup. After you save, make sure the file can be executed properly by the cron user. Common permissions for files in /usr/local/bin/ can be applied using (verify with your distribution!):&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/bin/ &amp;amp;&amp;amp; chown root:root backupwallet.sh &amp;amp;&amp;amp; chmod 755 backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
&lt;br /&gt;
==Restore==&lt;br /&gt;
&lt;br /&gt;
Assuming your backup is recent enough that you haven&#039;t used up all of your key pool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:&lt;br /&gt;
* Quit bitcoin(d).&lt;br /&gt;
* Copy your backed up wallet.dat into your bitcoin profile directory.&lt;br /&gt;
* If copying into existing profile, delete file &#039;&#039;blkindex.dat&#039;&#039; and &#039;&#039;blk0001.dat&#039;&#039; to make the client re-scan the block chain.&lt;br /&gt;
And you&#039;ll be good as new.&lt;br /&gt;
&lt;br /&gt;
==Erasing Plain Text Wallets==&lt;br /&gt;
&lt;br /&gt;
A good practice is to keep at least two wallets, one as a &amp;quot;current account&amp;quot; for everyday transactions and one as a &amp;quot;savings account&amp;quot; where you store the majority of your Bitcoins.  &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;savings account&amp;quot; wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your &amp;quot;current account&amp;quot; wallet.&lt;br /&gt;
&lt;br /&gt;
In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will &#039;&#039;not&#039;&#039; generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.&lt;br /&gt;
&lt;br /&gt;
The Linux &#039;&#039;&#039;shred&#039;&#039;&#039; command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover.  Using shred (and similar tools on Windows) however does not guarantee that still other copies don&#039;t exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your  filesystem, duplicating your wallet.dat.&lt;br /&gt;
&lt;br /&gt;
In Mac OS, the equivalent of &#039;&#039;&#039;shred&#039;&#039;&#039; is &#039;&#039;&#039;srm&#039;&#039;&#039; (introduced in Leopard). Using the Finder to remove files, clicking &amp;quot;Secure Empty Trash&amp;quot; in the Finder menu will shred the contents of the trash can. As with any OS this doesn&#039;t guarantee that there are not other copies elsewhere on your system.&lt;br /&gt;
&lt;br /&gt;
For Windows, the built-in command &#039;&#039;cipher /W&#039;&#039; will shred all previously-deleted files. [http://www.cylog.org/utilities/cybershredder.jsp CyberShredder] can securely deleted individual files.&lt;br /&gt;
&lt;br /&gt;
==eWallet==&lt;br /&gt;
&lt;br /&gt;
Storing bitcoins with an [[eWallet]] provider incurs risks as well. Basically you grant the third party, in this case eWallet, full access to your wallet.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Data directory]]&lt;br /&gt;
* [http://startbitcoin.com/how-to-create-a-secure-bitcoin-wallet/ Secure Bitcoin Wallet Tutorial]&lt;br /&gt;
* [[How to set up a secure offline savings wallet]]&lt;br /&gt;
&lt;br /&gt;
[[de:Sichere deine Geldbörse]]&lt;br /&gt;
[[zh-cn:保护你的钱包]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12232</id>
		<title>Securing your wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12232"/>
		<updated>2011-07-02T01:17:45Z</updated>

		<summary type="html">&lt;p&gt;D-man97: /* Linux solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Wallet security can be broken down into two independent goals:&lt;br /&gt;
# Protecting your wallet against loss.&lt;br /&gt;
# Protecting your wallet against theft.&lt;br /&gt;
&lt;br /&gt;
In the case that your current wallet hasn&#039;t been protected adequately (e.g. put online with a weaker password):&lt;br /&gt;
# Making a new secure wallet, using appropriate long-term protection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For a brief overview see also: [[Wallet Security Dos and Don&#039;ts (Windows)|Wallet Security Dos and Don&#039;ts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Technical Background==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions send Bitcoins to a specific public key. A Bitcoin address is an encoded hash of a public key. In order to use received Bitcoins, you need to have the private key matching the public key you received with. This is sort of like a super long password associated with an account (public key). Your Bitcoin wallet contains all of the private keys necessary for spending your received transactions. If you delete your wallet without a backup, then you no longer have the authorization information necessary to claim your coins, and the coins associated with those keys are lost forever.&lt;br /&gt;
&lt;br /&gt;
The wallet contains a pool of queued keys. By default there are 100 keys in the [[key pool]].  The size of the pool is configurable using the &amp;quot;-keypool&amp;quot; command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.&lt;br /&gt;
&lt;br /&gt;
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.&lt;br /&gt;
&lt;br /&gt;
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient&#039;s public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.&lt;br /&gt;
&lt;br /&gt;
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.&lt;br /&gt;
&lt;br /&gt;
== Making a new wallet ==&lt;br /&gt;
&lt;br /&gt;
In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.&lt;br /&gt;
&lt;br /&gt;
For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised.  Just re-encrypting isn&#039;t secure.  One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).&lt;br /&gt;
&lt;br /&gt;
==Making a secure workspace==&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
The first step is to make a [http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/ new user,] so run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser new_user_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as root. When you get to the prompt &#039;Enter the new value, or press ENTER for the default&#039;, just keep hitting ENTER.&lt;br /&gt;
&lt;br /&gt;
Then switch user to the new user.  To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the &#039;System/Quit&#039; screen, or if there is no switch icon on your system you can log out and log back in as the new user.  Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.&lt;br /&gt;
&lt;br /&gt;
For secure browsing, open Firefox, and then go into the Edit menu and click Preferences.  Starting from the left, click on the General tab, and in the &#039;Startup/When Firefox starts&#039; pop up menu, choose &#039;Show a Blank Page&#039;.  Then click on the Content tab, and deselect &#039;Load images automatically&#039; and deselect &#039;Enable Javascript&#039;.  Then click on the Privacy tab, and in the &#039;History/Firefox will&#039; pop up menu, choose &#039;Never remember history&#039;.  Then click on the Security tab, and in the Passwords section, deselect &#039;Remember passwords for sites&#039; and deselect &#039;Use a master password&#039;.  Then click on the Advanced tab, then click on the Update tab, and then in the &#039;Automatically check for updates to&#039; section, deselect &#039;Add-ons&#039; and &#039;Search Engines&#039;.&lt;br /&gt;
&lt;br /&gt;
When javascript is disabled, the [http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.23/bitcoin-0.3.23-linux.tar.gz/download linux download page] will not download automatically, so you&#039;ll have to click on the &#039;direct link&#039; part of the &amp;quot;Problems with the download? Please use this &#039;direct link&#039; or try another mirror.&amp;quot; line.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve made your secure new user, to maintain security you should use it only for bitcoin.&lt;br /&gt;
&lt;br /&gt;
It&#039;s also a good idea to encrypt the Home directory of whatever user you run Bitcoin under using ecryptfs-utils. To do this:&lt;br /&gt;
# If the Home directory is not empty you should back it up first, by just copying the data to an external drive or something.&lt;br /&gt;
# install ecryptfs-utils (on Ubuntu: sudo apt-get install ecryptfs-utils)&lt;br /&gt;
# log out of X (graphical system) and press Ctrl+Alt+F1 to login to the command shell (you must be logged out or some files will be open and the tool won&#039;t be able to encrypt your data)&lt;br /&gt;
# change directory to something that&#039;s not in your home folder (ex: cd / )&lt;br /&gt;
# run the migration tool (on Ubuntu: sudo ecryptfs-migrate-home -u username)&lt;br /&gt;
# if it&#039;s successful, you can now press ALT+F8 to go back to the GUI and login&lt;br /&gt;
# run &#039;ecryptfs-unwrap-passphrase&#039; and &#039;&#039;&#039;WRITE DOWN OR SAVE THE CODE IT RETURNS&#039;&#039;&#039; because you will need it if you ever have to pull your data off while the OS is not working. (You can run it again later if you need to, but run it now so that you can get your data if your Linux install gets botched.)&lt;br /&gt;
# run &#039;ecryptfs-setup-swap&#039; to encrypt your swap partition (the encrypted folder data is not encrypted while it&#039;s in memory, and so if it&#039;s ever sent to the swap partition it can be stolen from there unless that too is encrypted - be aware that this will mean you cannot use Hibernate anymore, as the bootloader won&#039;t be able to restore the hibernation data)&lt;br /&gt;
(instructions from [http://bodhizazen.net/Tutorials/Ecryptfs/#Migrate])&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
=====Backup all data (500MB)=====&lt;br /&gt;
Follow these instructions to backup all the bitcoin data (wallet and block chains) to an encrypted disk image.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 500MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move everything from ~/Library/Application Support/Bitcoin/ to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin ~/Library/Application Support/Bitcoin&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
=====Backup just wallet.dat (40MB)=====&lt;br /&gt;
Follow these instructions to backup just the wallet.dat file. This results in a smaller disk image, but it&#039;s more complicated to do.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 40MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move your wallet.dat file to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin/wallet.dat ~/Library/Application Support/Bitcoin/wallet.dat&lt;br /&gt;
&lt;br /&gt;
[[File:MountWalletAndLauchnBitcoin_OSX_Automator.png|thumbnail|150px|Mount Wallet and launch Bitcoin]]&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you start the Bitcoin application without having the image mounted, the application will overwrite your symlink with a new wallet. If that happens, don&#039;t panic. Just delete the new wallet.dat, mount the image, and recreate the symlink like above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Automation&#039;&#039;&#039;: You can create a small application using [http://en.wikipedia.org/wiki/Automator_%28software%29 Automator] (included in OS X) to automatically mount the wallet and then launch Bitcoin App. See the Screenshot on how to do this.&lt;br /&gt;
&lt;br /&gt;
If one &#039;&#039;doesn&#039;t&#039;&#039; want to use encrypted Disk images, then a &#039;&#039;&#039;small shell script&#039;&#039;&#039; can be used instead that takes care of decrypting the wallet, launching bitcoin client, and encrypting it after the client exits. This script works on both OSX and Linux: [http://lorelei.kaverit.org/bitcoin.sh bitcoin-launch-script]&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
If you are using Windows XP or Windows 7, you can keep your wallet on an encrypted disk image created by third-party software, such as [http://www.truecrypt.org/ TrueCrypt] (open source) or [http://www.jetico.com/encryption-bestcrypt/ Jetico BestCrypt] (commercial).  You can probably do the same with Windows Vista or Windows 2000.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You should configure BitCoin in this manner only on computers where you use BitCoin, but do not use that computer to mine.  For example, this is a good configuration for a notebook or tablet computer.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have installed the Windows BitCoin client and run it at least once, the process is described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;To mount the BitCoin data directory on an encrypted drive&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol start=1 type=1&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the third-party disk image encryption program of your choice to create and mount an encrypted disk image of at least 100 MB in size.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Locate the BitCoin data directory, and copy the directory with all contents to the encrypted drive.&lt;br /&gt;
&amp;lt;p&amp;gt;For help finding this directory, see &amp;lt;b&amp;gt;[[Securing_your_wallet#Locating_BitCoin_s_data_directory|Locating BitCoin&#039;s Data Directory]]&amp;lt;/b&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a Windows shortcut that starts BitCoin with the &amp;lt;code&amp;gt;-datadir&amp;lt;/code&amp;gt; parameter and specifies the encrypted drive and directory.&lt;br /&gt;
&amp;lt;p&amp;gt;For example, if you installed Bitcoin in the default directory, mounted your BitCoin encrypted drive as &amp;lt;code&amp;gt;E:\&amp;lt;/code&amp;gt;, and stored your BitCoin data directory on it as &amp;lt;code&amp;gt;Bitcoin&amp;lt;/code&amp;gt;, you would type the following command as the shortcut Target:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;C:\Program Files\Bitcoin\bitcoin.exe -datadir=E:\Bitcoin&amp;lt;/code&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open BitCoin&#039;s settings and configure it &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; to start automatically when you start Windows.&lt;br /&gt;
&amp;lt;p&amp;gt;This is to allow you to mount the BitCoin encrypted disk image before starting BitCoin.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Shut down BitCoin, and then restart it from the new shortcut.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After doing this, any time you want to use BitCoin, you must first mount the BitCoin encrypted disk image using the same drive designation, and then run BitCoin from the shortcut that you created, so that it can find its data and your wallet. :-)&lt;br /&gt;
&lt;br /&gt;
== Locating BitCoin&#039;s data directory ==&lt;br /&gt;
&lt;br /&gt;
The [[data directory]] is the location where Bitcoin&#039;s data files are stored, including the wallet data file.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
Go to Start -&amp;gt; Run (or press WinKey+R) and run this:&lt;br /&gt;
&lt;br /&gt;
 explorer %APPDATA%\BitCoin&lt;br /&gt;
&lt;br /&gt;
BitCoin&#039;s data folder will open. For most users, this is the following locations:&lt;br /&gt;
&lt;br /&gt;
 C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)&lt;br /&gt;
 &lt;br /&gt;
 C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;AppData&amp;quot; and &amp;quot;Application data&amp;quot; are hidden by default.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/.bitcoin/&lt;br /&gt;
&lt;br /&gt;
You need to do a &amp;quot;ls -a&amp;quot; to see directories that start with a dot.&lt;br /&gt;
&lt;br /&gt;
If that&#039;s not it, you can do a search like this:&lt;br /&gt;
&lt;br /&gt;
 find / -name wallet.dat -print 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/Library/Application Support/Bitcoin/&lt;br /&gt;
&lt;br /&gt;
==Backup==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: I would strongly recommend against using Dropbox to back up your Bitcoin data due to [http://en.wikipedia.org/wiki/Dropbox_(service)#Criticism security concerns] such as:&lt;br /&gt;
# the fact that they store your encryption key (meaning that a disgruntled Dropbox employee or an attacker who gained access to the system could decrypt your Dropbox data and steal your Bitcoins)&lt;br /&gt;
# the fact that the Dropbox client only needs a password for the first login. After it authenticates once, the server assigns it a token which it uses to show that, at one time, its user knew the password rather than sending the actual password (meaning that if you ever use the Dropbox client on another PC, that PC&#039;s users can access your Dropbox - even if you change your password - and can steal your Bitcoins or get a virus that will steal your Bitcoins).&lt;br /&gt;
&lt;br /&gt;
For these reasons, I personally prefer to use Wuala, which does not store your encryption key and requires a password each time (the client can be set to remember your password, but the server will check each time to make sure that the client is sending the correct password). Like Dropbox, the basic, lowest-storage-space account with Wuala is free of charge, and coincidentally, Wuala [http://www.wuala.com/en/bitcoin is experimenting with allowing users to pay for &amp;quot;upgraded&amp;quot; plans using Bitcoin.]&lt;br /&gt;
&lt;br /&gt;
In fact, whether you use Dropbox as your backup or not, use what Steve Gibson calls &amp;quot;pre-Internet encryption&amp;quot; (which he actually [http://itknowledgeexchange.techtarget.com/security-corner/cloud-security-and-privacy-do-they-exist/ discussed in the context of Dropbox&#039;s security concerns]) and use some form of encryption on the files before you back them up, just in case someone other than yourself ever gains access to that backup. Make sure to pick a password that&#039;s memorable but secure.&lt;br /&gt;
&lt;br /&gt;
The only file you need to back up is &amp;quot;wallet.dat&amp;quot;. Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.&lt;br /&gt;
&lt;br /&gt;
You can use the [[api|backupwallet]] JSON-RPC command to back up without shutting down Bitcoin.&lt;br /&gt;
&lt;br /&gt;
=== General Solutions ===&lt;br /&gt;
&lt;br /&gt;
Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.&lt;br /&gt;
* [http://www.7-zip.org/ 7-zip] - Supports strongly-encrypted archives.&lt;br /&gt;
* [http://www.axantum.com/axcrypt/ AxCrypt]&lt;br /&gt;
* [http://lrzip.kolivas.org lrzip] - Compression software for Linux and OSX that supports very high grade password protected encryption&lt;br /&gt;
* [http://www.truecrypt.org/ TrueCrypt] - Volume-based on-the-fly encryption (for advanced users)&lt;br /&gt;
* [http://www.rarlab.com/ WinRar] - Commonly used archive software that supports verification records and encryption.&lt;br /&gt;
&lt;br /&gt;
There is also a list of [[OpenSourceEncryptionSoftware|open source encryption software.]]&lt;br /&gt;
&lt;br /&gt;
Decrypting and encrypting the wallet.dat every time you start or quit the Bitcoin client can be &#039;&#039;tedious&#039;&#039; (and outright error-prone). If you want to keep your wallet encrypted (except while you&#039;re actually running the Bitcoin client), it&#039;s better to relegate the automation to a [http://lorelei.kaverit.org/bitcoin.sh small shell script] that handles the en/decryption and starting up Bitcoin client for you (Linux and OSX). &lt;br /&gt;
&lt;br /&gt;
There is also a method to Print out and encrypt your Wallet.dat as a special barcode. See details here: [[WalletPaperbackup]]&lt;br /&gt;
&lt;br /&gt;
==== Password Strength ====&lt;br /&gt;
Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is &#039;&#039;&#039;at least&#039;&#039;&#039; 12 characters long.  You can also use a multi-word password. [http://www.baekdal.com/tips/password-security-usability The Usability of Passwords] &lt;br /&gt;
&lt;br /&gt;
However, simply using dictionary words is also insecure as it opens you up to a dictionary attack. If you use dictionary words, be sure to throw random symbols and numbers in the mix as well.&lt;br /&gt;
&lt;br /&gt;
A good way to create secure but easy-to-remember passwords is to pick a password (ex: d0g) and pad it with a good number of repeated characters afterward (such as 10 $ signs - so d0g becomes d0g$$$$$$$$$$) - this is just as cryptographically secure as a random password of equal length so long as the attacker does not know which symbol you are following your &amp;quot;word&amp;quot; with and how many times it is repeated. ([https://www.grc.com/haystack.htm source])&lt;br /&gt;
&lt;br /&gt;
If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.&lt;br /&gt;
&lt;br /&gt;
Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.&lt;br /&gt;
&lt;br /&gt;
===== Choosing Your Password =====&lt;br /&gt;
Make sure you pick at least one character in each group:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Lowercase: abcdefghijklmnopqrstuvwxyz&lt;br /&gt;
  Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;br /&gt;
  Number: 1234567890&lt;br /&gt;
  Symbol: `~!@#$%^&amp;amp;*()-_=+\|[{]};:&#039;&amp;quot;,&amp;lt;.&amp;gt;/? (space)&lt;br /&gt;
  &lt;br /&gt;
  09 char = insecure&lt;br /&gt;
  10 char = low security&lt;br /&gt;
  11 char = medium security&lt;br /&gt;
  12 char = good security (good enough for your wallet)&lt;br /&gt;
  13 char = v.good enough for anything.&lt;br /&gt;
&lt;br /&gt;
==== Storage of Archive ====&lt;br /&gt;
One of the most simple methods for storing a appropriately &#039;&#039;&#039;encrypted&#039;&#039;&#039; archive of your wallet.dat file is to send the archive as an email attachment to your own e-mail address.  Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely.  One can even obfuscate the name of the files within the archive, and name the archive something less inviting, such as: &#039;personal notes&#039; or &#039;car insurance&#039;.&lt;br /&gt;
&lt;br /&gt;
Another solution is to use a file storage service like [http://www.wuala.com/bitcoin Wuala] ( encrypted, [http://www.bitcoin.org/smf/index.php?topic=5817.0 instructions]), [http://www.dropbox.com Dropbox] and [http://en.wikipedia.org/wiki/Comparison_of_online_backup_services others], including the more secure [http://www.spideroak.com SpiderOak].&lt;br /&gt;
&lt;br /&gt;
=== Linux solution ===&lt;br /&gt;
&lt;br /&gt;
Linux users can setup backups using cron by telling it to run a backup script at set intervals of time. Run &#039;crontab -e&#039; and add this line near the bottom:&lt;br /&gt;
&lt;br /&gt;
 01 */1 * * * /usr/local/bin/backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
This cron line will run the /usr/local/bin/backupwallet.sh script at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won&#039;t run. You may also wish to ignore the scripts output by appending &amp;quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&amp;quot; to the line.&lt;br /&gt;
&lt;br /&gt;
Create backupwallet.sh:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # /usr/local/bin/backupwallet.sh&lt;br /&gt;
 #&lt;br /&gt;
 # Performs backup of bitcoin wallet.&lt;br /&gt;
 #&lt;br /&gt;
 # Written by: https://en.bitcoin.it/wiki/Securing_your_wallet&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Standard Options&lt;br /&gt;
 #&lt;br /&gt;
 TS=$(date &amp;quot;+%Y%m%d-%H%M&amp;quot;)&lt;br /&gt;
 WALLET=/tmp/wallet${TS}&lt;br /&gt;
 WALLET_E=/tmp/wallet${TS}.crypt&lt;br /&gt;
 USERNAME=username  # Update to your bitcoin Linux username.&lt;br /&gt;
 RM=rm&lt;br /&gt;
 RM_OPTS=--force&lt;br /&gt;
 USE_SHRED=0  # Flip to 1 to use `shred` instead of `rm`.&lt;br /&gt;
 SHRED=shred&lt;br /&gt;
 SHRED_OPTS=--force --iterations=9 --zero --remove&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Storage Options&lt;br /&gt;
 # Only 1 option should be un-commented (the last one will be used).&lt;br /&gt;
 # Update CP_DEST paths as neccessary.&lt;br /&gt;
 #&lt;br /&gt;
 # CP - Storage on a local (or networked) machine. Could be Dropbox/Wuala folder.&lt;br /&gt;
 #CP=cp&lt;br /&gt;
 #CP_DEST=smb://machine/share/folder/  # /var/data/backups/, ~/Dropbox/, etc.&lt;br /&gt;
 #&lt;br /&gt;
 # SSH - Storage on a remote machine.&lt;br /&gt;
 CP=scp&lt;br /&gt;
 CP_DEST=&amp;quot;remoteuser@example.com:~/wallets/&amp;quot;&lt;br /&gt;
 #&lt;br /&gt;
 # S3 - Storage on Amazon&#039;s S3. Be sure s3cmd is installed and properly setup.&lt;br /&gt;
 # You may need &amp;quot;s3cmd put --force&amp;quot; if you use a sub-directory in CP_DEST.&lt;br /&gt;
 #CP=s3cmd put&lt;br /&gt;
 #CP_DEST=s3://bucket&lt;br /&gt;
 &lt;br /&gt;
 do_clean() {&lt;br /&gt;
   # Remove temporary wallets.&lt;br /&gt;
   if [ 1 -eq $USE_SHRED ]; then&lt;br /&gt;
     $SHRED $SHRED_OPTS $WALLET $WALLET_E&lt;br /&gt;
   else&lt;br /&gt;
     $RM $RM_OPTS $WALLET $WALLET_E&lt;br /&gt;
   fi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 do_fail() {&lt;br /&gt;
   echo failed!&lt;br /&gt;
   do_clean&lt;br /&gt;
   exit 1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # Perform the backup.&lt;br /&gt;
 echo -n Making backup...&lt;br /&gt;
 bitcoind backupwallet $WALLET&lt;br /&gt;
 [ ! -s &amp;quot;$WALLET&amp;quot; ] &amp;amp;&amp;amp; do_fail  # If the backup does not exist or is empty, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Encrypting backup....&lt;br /&gt;
 gpg -r $USERNAME --output $WALLET_E --encrypt $WALLET&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If gpg returns a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Copying to backup location...&lt;br /&gt;
 $CP $WALLET_E $CP_DEST&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If the $CP command returns a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 do_clean&lt;br /&gt;
 &lt;br /&gt;
 exit 0&lt;br /&gt;
&lt;br /&gt;
The shell script:&lt;br /&gt;
&lt;br /&gt;
* Calls bitcoind backupwallet to create a time/date-stamped wallet.&lt;br /&gt;
* GPG encrypts the wallet with your public key.&lt;br /&gt;
* Copies the result using one of several storage options (cp, scp, and s3cmd).&lt;br /&gt;
* Uses the rm or shred command to remove the temporary wallet files.&lt;br /&gt;
&lt;br /&gt;
Be sure to modify the script options to fit your setup. After you save, make sure the file can be executed properly by the cron user. Common permissions for files in /usr/local/bin/ can be applied using (verify with your distribution!):&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/bin/ &amp;amp;&amp;amp; chown root:root backupwallet.sh &amp;amp;&amp;amp; chmod 755 backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
&lt;br /&gt;
==Restore==&lt;br /&gt;
&lt;br /&gt;
Assuming your backup is recent enough that you haven&#039;t used up all of your key pool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:&lt;br /&gt;
* Quit bitcoin(d).&lt;br /&gt;
* Copy your backed up wallet.dat into your bitcoin profile directory.&lt;br /&gt;
* If copying into existing profile, delete file &#039;&#039;blkindex.dat&#039;&#039; and &#039;&#039;blk0001.dat&#039;&#039; to make the client re-scan the block chain.&lt;br /&gt;
And you&#039;ll be good as new.&lt;br /&gt;
&lt;br /&gt;
==Erasing Plain Text Wallets==&lt;br /&gt;
&lt;br /&gt;
A good practice is to keep at least two wallets, one as a &amp;quot;current account&amp;quot; for everyday transactions and one as a &amp;quot;savings account&amp;quot; where you store the majority of your Bitcoins.  &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;savings account&amp;quot; wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your &amp;quot;current account&amp;quot; wallet.&lt;br /&gt;
&lt;br /&gt;
In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will &#039;&#039;not&#039;&#039; generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.&lt;br /&gt;
&lt;br /&gt;
The Linux &#039;&#039;&#039;shred&#039;&#039;&#039; command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover.  Using shred (and similar tools on Windows) however does not guarantee that still other copies don&#039;t exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your  filesystem, duplicating your wallet.dat.&lt;br /&gt;
&lt;br /&gt;
In Mac OS, the equivalent of &#039;&#039;&#039;shred&#039;&#039;&#039; is &#039;&#039;&#039;srm&#039;&#039;&#039; (introduced in Leopard). Using the Finder to remove files, clicking &amp;quot;Secure Empty Trash&amp;quot; in the Finder menu will shred the contents of the trash can. As with any OS this doesn&#039;t guarantee that there are not other copies elsewhere on your system.&lt;br /&gt;
&lt;br /&gt;
For Windows, the built-in command &#039;&#039;cipher /W&#039;&#039; will shred all previously-deleted files. [http://www.cylog.org/utilities/cybershredder.jsp CyberShredder] can securely deleted individual files.&lt;br /&gt;
&lt;br /&gt;
==eWallet==&lt;br /&gt;
&lt;br /&gt;
Storing bitcoins with an [[eWallet]] provider incurs risks as well. Basically you grant the third party, in this case eWallet, full access to your wallet.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Data directory]]&lt;br /&gt;
* [http://startbitcoin.com/how-to-create-a-secure-bitcoin-wallet/ Secure Bitcoin Wallet Tutorial]&lt;br /&gt;
* [[How to set up a secure offline savings wallet]]&lt;br /&gt;
&lt;br /&gt;
[[de:Sichere deine Geldbörse]]&lt;br /&gt;
[[zh-cn:保护你的钱包]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12230</id>
		<title>Securing your wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12230"/>
		<updated>2011-07-02T01:16:51Z</updated>

		<summary type="html">&lt;p&gt;D-man97: /* Linux solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Wallet security can be broken down into two independent goals:&lt;br /&gt;
# Protecting your wallet against loss.&lt;br /&gt;
# Protecting your wallet against theft.&lt;br /&gt;
&lt;br /&gt;
In the case that your current wallet hasn&#039;t been protected adequately (e.g. put online with a weaker password):&lt;br /&gt;
# Making a new secure wallet, using appropriate long-term protection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For a brief overview see also: [[Wallet Security Dos and Don&#039;ts (Windows)|Wallet Security Dos and Don&#039;ts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Technical Background==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions send Bitcoins to a specific public key. A Bitcoin address is an encoded hash of a public key. In order to use received Bitcoins, you need to have the private key matching the public key you received with. This is sort of like a super long password associated with an account (public key). Your Bitcoin wallet contains all of the private keys necessary for spending your received transactions. If you delete your wallet without a backup, then you no longer have the authorization information necessary to claim your coins, and the coins associated with those keys are lost forever.&lt;br /&gt;
&lt;br /&gt;
The wallet contains a pool of queued keys. By default there are 100 keys in the [[key pool]].  The size of the pool is configurable using the &amp;quot;-keypool&amp;quot; command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.&lt;br /&gt;
&lt;br /&gt;
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.&lt;br /&gt;
&lt;br /&gt;
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient&#039;s public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.&lt;br /&gt;
&lt;br /&gt;
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.&lt;br /&gt;
&lt;br /&gt;
== Making a new wallet ==&lt;br /&gt;
&lt;br /&gt;
In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.&lt;br /&gt;
&lt;br /&gt;
For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised.  Just re-encrypting isn&#039;t secure.  One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).&lt;br /&gt;
&lt;br /&gt;
==Making a secure workspace==&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
The first step is to make a [http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/ new user,] so run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser new_user_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as root. When you get to the prompt &#039;Enter the new value, or press ENTER for the default&#039;, just keep hitting ENTER.&lt;br /&gt;
&lt;br /&gt;
Then switch user to the new user.  To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the &#039;System/Quit&#039; screen, or if there is no switch icon on your system you can log out and log back in as the new user.  Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.&lt;br /&gt;
&lt;br /&gt;
For secure browsing, open Firefox, and then go into the Edit menu and click Preferences.  Starting from the left, click on the General tab, and in the &#039;Startup/When Firefox starts&#039; pop up menu, choose &#039;Show a Blank Page&#039;.  Then click on the Content tab, and deselect &#039;Load images automatically&#039; and deselect &#039;Enable Javascript&#039;.  Then click on the Privacy tab, and in the &#039;History/Firefox will&#039; pop up menu, choose &#039;Never remember history&#039;.  Then click on the Security tab, and in the Passwords section, deselect &#039;Remember passwords for sites&#039; and deselect &#039;Use a master password&#039;.  Then click on the Advanced tab, then click on the Update tab, and then in the &#039;Automatically check for updates to&#039; section, deselect &#039;Add-ons&#039; and &#039;Search Engines&#039;.&lt;br /&gt;
&lt;br /&gt;
When javascript is disabled, the [http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.23/bitcoin-0.3.23-linux.tar.gz/download linux download page] will not download automatically, so you&#039;ll have to click on the &#039;direct link&#039; part of the &amp;quot;Problems with the download? Please use this &#039;direct link&#039; or try another mirror.&amp;quot; line.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve made your secure new user, to maintain security you should use it only for bitcoin.&lt;br /&gt;
&lt;br /&gt;
It&#039;s also a good idea to encrypt the Home directory of whatever user you run Bitcoin under using ecryptfs-utils. To do this:&lt;br /&gt;
# If the Home directory is not empty you should back it up first, by just copying the data to an external drive or something.&lt;br /&gt;
# install ecryptfs-utils (on Ubuntu: sudo apt-get install ecryptfs-utils)&lt;br /&gt;
# log out of X (graphical system) and press Ctrl+Alt+F1 to login to the command shell (you must be logged out or some files will be open and the tool won&#039;t be able to encrypt your data)&lt;br /&gt;
# change directory to something that&#039;s not in your home folder (ex: cd / )&lt;br /&gt;
# run the migration tool (on Ubuntu: sudo ecryptfs-migrate-home -u username)&lt;br /&gt;
# if it&#039;s successful, you can now press ALT+F8 to go back to the GUI and login&lt;br /&gt;
# run &#039;ecryptfs-unwrap-passphrase&#039; and &#039;&#039;&#039;WRITE DOWN OR SAVE THE CODE IT RETURNS&#039;&#039;&#039; because you will need it if you ever have to pull your data off while the OS is not working. (You can run it again later if you need to, but run it now so that you can get your data if your Linux install gets botched.)&lt;br /&gt;
# run &#039;ecryptfs-setup-swap&#039; to encrypt your swap partition (the encrypted folder data is not encrypted while it&#039;s in memory, and so if it&#039;s ever sent to the swap partition it can be stolen from there unless that too is encrypted - be aware that this will mean you cannot use Hibernate anymore, as the bootloader won&#039;t be able to restore the hibernation data)&lt;br /&gt;
(instructions from [http://bodhizazen.net/Tutorials/Ecryptfs/#Migrate])&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
=====Backup all data (500MB)=====&lt;br /&gt;
Follow these instructions to backup all the bitcoin data (wallet and block chains) to an encrypted disk image.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 500MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move everything from ~/Library/Application Support/Bitcoin/ to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin ~/Library/Application Support/Bitcoin&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
=====Backup just wallet.dat (40MB)=====&lt;br /&gt;
Follow these instructions to backup just the wallet.dat file. This results in a smaller disk image, but it&#039;s more complicated to do.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 40MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move your wallet.dat file to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin/wallet.dat ~/Library/Application Support/Bitcoin/wallet.dat&lt;br /&gt;
&lt;br /&gt;
[[File:MountWalletAndLauchnBitcoin_OSX_Automator.png|thumbnail|150px|Mount Wallet and launch Bitcoin]]&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you start the Bitcoin application without having the image mounted, the application will overwrite your symlink with a new wallet. If that happens, don&#039;t panic. Just delete the new wallet.dat, mount the image, and recreate the symlink like above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Automation&#039;&#039;&#039;: You can create a small application using [http://en.wikipedia.org/wiki/Automator_%28software%29 Automator] (included in OS X) to automatically mount the wallet and then launch Bitcoin App. See the Screenshot on how to do this.&lt;br /&gt;
&lt;br /&gt;
If one &#039;&#039;doesn&#039;t&#039;&#039; want to use encrypted Disk images, then a &#039;&#039;&#039;small shell script&#039;&#039;&#039; can be used instead that takes care of decrypting the wallet, launching bitcoin client, and encrypting it after the client exits. This script works on both OSX and Linux: [http://lorelei.kaverit.org/bitcoin.sh bitcoin-launch-script]&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
If you are using Windows XP or Windows 7, you can keep your wallet on an encrypted disk image created by third-party software, such as [http://www.truecrypt.org/ TrueCrypt] (open source) or [http://www.jetico.com/encryption-bestcrypt/ Jetico BestCrypt] (commercial).  You can probably do the same with Windows Vista or Windows 2000.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You should configure BitCoin in this manner only on computers where you use BitCoin, but do not use that computer to mine.  For example, this is a good configuration for a notebook or tablet computer.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have installed the Windows BitCoin client and run it at least once, the process is described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;To mount the BitCoin data directory on an encrypted drive&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol start=1 type=1&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the third-party disk image encryption program of your choice to create and mount an encrypted disk image of at least 100 MB in size.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Locate the BitCoin data directory, and copy the directory with all contents to the encrypted drive.&lt;br /&gt;
&amp;lt;p&amp;gt;For help finding this directory, see &amp;lt;b&amp;gt;[[Securing_your_wallet#Locating_BitCoin_s_data_directory|Locating BitCoin&#039;s Data Directory]]&amp;lt;/b&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a Windows shortcut that starts BitCoin with the &amp;lt;code&amp;gt;-datadir&amp;lt;/code&amp;gt; parameter and specifies the encrypted drive and directory.&lt;br /&gt;
&amp;lt;p&amp;gt;For example, if you installed Bitcoin in the default directory, mounted your BitCoin encrypted drive as &amp;lt;code&amp;gt;E:\&amp;lt;/code&amp;gt;, and stored your BitCoin data directory on it as &amp;lt;code&amp;gt;Bitcoin&amp;lt;/code&amp;gt;, you would type the following command as the shortcut Target:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;C:\Program Files\Bitcoin\bitcoin.exe -datadir=E:\Bitcoin&amp;lt;/code&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open BitCoin&#039;s settings and configure it &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; to start automatically when you start Windows.&lt;br /&gt;
&amp;lt;p&amp;gt;This is to allow you to mount the BitCoin encrypted disk image before starting BitCoin.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Shut down BitCoin, and then restart it from the new shortcut.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After doing this, any time you want to use BitCoin, you must first mount the BitCoin encrypted disk image using the same drive designation, and then run BitCoin from the shortcut that you created, so that it can find its data and your wallet. :-)&lt;br /&gt;
&lt;br /&gt;
== Locating BitCoin&#039;s data directory ==&lt;br /&gt;
&lt;br /&gt;
The [[data directory]] is the location where Bitcoin&#039;s data files are stored, including the wallet data file.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
Go to Start -&amp;gt; Run (or press WinKey+R) and run this:&lt;br /&gt;
&lt;br /&gt;
 explorer %APPDATA%\BitCoin&lt;br /&gt;
&lt;br /&gt;
BitCoin&#039;s data folder will open. For most users, this is the following locations:&lt;br /&gt;
&lt;br /&gt;
 C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)&lt;br /&gt;
 &lt;br /&gt;
 C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;AppData&amp;quot; and &amp;quot;Application data&amp;quot; are hidden by default.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/.bitcoin/&lt;br /&gt;
&lt;br /&gt;
You need to do a &amp;quot;ls -a&amp;quot; to see directories that start with a dot.&lt;br /&gt;
&lt;br /&gt;
If that&#039;s not it, you can do a search like this:&lt;br /&gt;
&lt;br /&gt;
 find / -name wallet.dat -print 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/Library/Application Support/Bitcoin/&lt;br /&gt;
&lt;br /&gt;
==Backup==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: I would strongly recommend against using Dropbox to back up your Bitcoin data due to [http://en.wikipedia.org/wiki/Dropbox_(service)#Criticism security concerns] such as:&lt;br /&gt;
# the fact that they store your encryption key (meaning that a disgruntled Dropbox employee or an attacker who gained access to the system could decrypt your Dropbox data and steal your Bitcoins)&lt;br /&gt;
# the fact that the Dropbox client only needs a password for the first login. After it authenticates once, the server assigns it a token which it uses to show that, at one time, its user knew the password rather than sending the actual password (meaning that if you ever use the Dropbox client on another PC, that PC&#039;s users can access your Dropbox - even if you change your password - and can steal your Bitcoins or get a virus that will steal your Bitcoins).&lt;br /&gt;
&lt;br /&gt;
For these reasons, I personally prefer to use Wuala, which does not store your encryption key and requires a password each time (the client can be set to remember your password, but the server will check each time to make sure that the client is sending the correct password). Like Dropbox, the basic, lowest-storage-space account with Wuala is free of charge, and coincidentally, Wuala [http://www.wuala.com/en/bitcoin is experimenting with allowing users to pay for &amp;quot;upgraded&amp;quot; plans using Bitcoin.]&lt;br /&gt;
&lt;br /&gt;
In fact, whether you use Dropbox as your backup or not, use what Steve Gibson calls &amp;quot;pre-Internet encryption&amp;quot; (which he actually [http://itknowledgeexchange.techtarget.com/security-corner/cloud-security-and-privacy-do-they-exist/ discussed in the context of Dropbox&#039;s security concerns]) and use some form of encryption on the files before you back them up, just in case someone other than yourself ever gains access to that backup. Make sure to pick a password that&#039;s memorable but secure.&lt;br /&gt;
&lt;br /&gt;
The only file you need to back up is &amp;quot;wallet.dat&amp;quot;. Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.&lt;br /&gt;
&lt;br /&gt;
You can use the [[api|backupwallet]] JSON-RPC command to back up without shutting down Bitcoin.&lt;br /&gt;
&lt;br /&gt;
=== General Solutions ===&lt;br /&gt;
&lt;br /&gt;
Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.&lt;br /&gt;
* [http://www.7-zip.org/ 7-zip] - Supports strongly-encrypted archives.&lt;br /&gt;
* [http://www.axantum.com/axcrypt/ AxCrypt]&lt;br /&gt;
* [http://lrzip.kolivas.org lrzip] - Compression software for Linux and OSX that supports very high grade password protected encryption&lt;br /&gt;
* [http://www.truecrypt.org/ TrueCrypt] - Volume-based on-the-fly encryption (for advanced users)&lt;br /&gt;
* [http://www.rarlab.com/ WinRar] - Commonly used archive software that supports verification records and encryption.&lt;br /&gt;
&lt;br /&gt;
There is also a list of [[OpenSourceEncryptionSoftware|open source encryption software.]]&lt;br /&gt;
&lt;br /&gt;
Decrypting and encrypting the wallet.dat every time you start or quit the Bitcoin client can be &#039;&#039;tedious&#039;&#039; (and outright error-prone). If you want to keep your wallet encrypted (except while you&#039;re actually running the Bitcoin client), it&#039;s better to relegate the automation to a [http://lorelei.kaverit.org/bitcoin.sh small shell script] that handles the en/decryption and starting up Bitcoin client for you (Linux and OSX). &lt;br /&gt;
&lt;br /&gt;
There is also a method to Print out and encrypt your Wallet.dat as a special barcode. See details here: [[WalletPaperbackup]]&lt;br /&gt;
&lt;br /&gt;
==== Password Strength ====&lt;br /&gt;
Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is &#039;&#039;&#039;at least&#039;&#039;&#039; 12 characters long.  You can also use a multi-word password. [http://www.baekdal.com/tips/password-security-usability The Usability of Passwords] &lt;br /&gt;
&lt;br /&gt;
However, simply using dictionary words is also insecure as it opens you up to a dictionary attack. If you use dictionary words, be sure to throw random symbols and numbers in the mix as well.&lt;br /&gt;
&lt;br /&gt;
A good way to create secure but easy-to-remember passwords is to pick a password (ex: d0g) and pad it with a good number of repeated characters afterward (such as 10 $ signs - so d0g becomes d0g$$$$$$$$$$) - this is just as cryptographically secure as a random password of equal length so long as the attacker does not know which symbol you are following your &amp;quot;word&amp;quot; with and how many times it is repeated. ([https://www.grc.com/haystack.htm source])&lt;br /&gt;
&lt;br /&gt;
If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.&lt;br /&gt;
&lt;br /&gt;
Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.&lt;br /&gt;
&lt;br /&gt;
===== Choosing Your Password =====&lt;br /&gt;
Make sure you pick at least one character in each group:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Lowercase: abcdefghijklmnopqrstuvwxyz&lt;br /&gt;
  Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;br /&gt;
  Number: 1234567890&lt;br /&gt;
  Symbol: `~!@#$%^&amp;amp;*()-_=+\|[{]};:&#039;&amp;quot;,&amp;lt;.&amp;gt;/? (space)&lt;br /&gt;
  &lt;br /&gt;
  09 char = insecure&lt;br /&gt;
  10 char = low security&lt;br /&gt;
  11 char = medium security&lt;br /&gt;
  12 char = good security (good enough for your wallet)&lt;br /&gt;
  13 char = v.good enough for anything.&lt;br /&gt;
&lt;br /&gt;
==== Storage of Archive ====&lt;br /&gt;
One of the most simple methods for storing a appropriately &#039;&#039;&#039;encrypted&#039;&#039;&#039; archive of your wallet.dat file is to send the archive as an email attachment to your own e-mail address.  Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely.  One can even obfuscate the name of the files within the archive, and name the archive something less inviting, such as: &#039;personal notes&#039; or &#039;car insurance&#039;.&lt;br /&gt;
&lt;br /&gt;
Another solution is to use a file storage service like [http://www.wuala.com/bitcoin Wuala] ( encrypted, [http://www.bitcoin.org/smf/index.php?topic=5817.0 instructions]), [http://www.dropbox.com Dropbox] and [http://en.wikipedia.org/wiki/Comparison_of_online_backup_services others], including the more secure [http://www.spideroak.com SpiderOak].&lt;br /&gt;
&lt;br /&gt;
=== Linux solution ===&lt;br /&gt;
&lt;br /&gt;
Linux users can setup backups using cron by telling it to run a backup script at set intervals of time. Run &#039;crontab -e&#039; and add this line near the bottom:&lt;br /&gt;
&lt;br /&gt;
 01 */1 * * * /usr/local/bin/backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
This cron line will run the /usr/local/bin/backupwallet.sh script at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won&#039;t run. You may also wish to ignore the scripts output by appending &amp;quot; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1&amp;quot; to the line.&lt;br /&gt;
&lt;br /&gt;
Create backupwallet.sh:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # /usr/local/bin/backupwallet.sh&lt;br /&gt;
 #&lt;br /&gt;
 # Performs backup of bitcoin wallet.&lt;br /&gt;
 #&lt;br /&gt;
 # Written by: https://en.bitcoin.it/wiki/Securing_your_wallet&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Standard Options&lt;br /&gt;
 #&lt;br /&gt;
 TS=$(date &amp;quot;+%Y%m%d-%H%M&amp;quot;)&lt;br /&gt;
 WALLET=/tmp/wallet${TS}&lt;br /&gt;
 WALLET_E=/tmp/wallet${TS}.crypt&lt;br /&gt;
 USERNAME=username  # Update to your bitcoin Linux username.&lt;br /&gt;
 RM=rm&lt;br /&gt;
 RM_OPTS=--force&lt;br /&gt;
 USE_SHRED=0  # Flip to 1 to use `shred` instead of `rm`.&lt;br /&gt;
 SHRED=shred&lt;br /&gt;
 SHRED_OPTS=--force --iterations=9 --zero --remove&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Storage Options&lt;br /&gt;
 # Only 1 option should be un-commented (the last one will be used).&lt;br /&gt;
 # Update CP_DEST paths as neccessary.&lt;br /&gt;
 #&lt;br /&gt;
 # CP - Storage on a local (or networked) machine. Could be Dropbox/Wuala folder.&lt;br /&gt;
 #CP=cp&lt;br /&gt;
 #CP_DEST=smb://machine/share/folder/  # /var/data/backups/, ~/Dropbox/, etc.&lt;br /&gt;
 #&lt;br /&gt;
 # SSH - Storage on a remote machine.&lt;br /&gt;
 CP=scp&lt;br /&gt;
 CP_DEST=&amp;quot;remoteuser@example.com:~/wallets/&amp;quot;&lt;br /&gt;
 #&lt;br /&gt;
 # S3 - Storage on Amazon&#039;s S3. Be sure s3cmd is installed and properly setup.&lt;br /&gt;
 # You may need &amp;quot;s3cmd put --force&amp;quot; if you use a sub-directory in CP_DEST.&lt;br /&gt;
 #CP=s3cmd put&lt;br /&gt;
 #CP_DEST=s3://bucket&lt;br /&gt;
 &lt;br /&gt;
 do_clean() {&lt;br /&gt;
   # Remove temporary wallets.&lt;br /&gt;
   if [ 1 -eq $USE_SHRED ]; then&lt;br /&gt;
     $SHRED $SHRED_OPTS $WALLET $WALLET_E&lt;br /&gt;
   else&lt;br /&gt;
     $RM $RM_OPTS $WALLET $WALLET_E&lt;br /&gt;
   fi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 do_fail() {&lt;br /&gt;
   echo failed!&lt;br /&gt;
   do_clean&lt;br /&gt;
   exit 1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # Perform the backup.&lt;br /&gt;
 echo -n Making backup...&lt;br /&gt;
 bitcoind backupwallet $WALLET&lt;br /&gt;
 [ ! -s &amp;quot;$WALLET&amp;quot; ] &amp;amp;&amp;amp; do_fail  # If the backup does not exist or is empty, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Encrypting backup....&lt;br /&gt;
 gpg -r $USERNAME --output $WALLET_E --encrypt $WALLET&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If gpg returned a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Copying to backup location...&lt;br /&gt;
 $CP $WALLET_E $CP_DEST&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If the $CP command returns a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 do_clean&lt;br /&gt;
 &lt;br /&gt;
 exit 0&lt;br /&gt;
&lt;br /&gt;
The shell script:&lt;br /&gt;
&lt;br /&gt;
* Calls bitcoind backupwallet to create a time/date-stamped wallet.&lt;br /&gt;
* GPG encrypts the wallet with your public key.&lt;br /&gt;
* Copies the result using one of several storage options (cp, scp, and s3cmd).&lt;br /&gt;
* Uses the rm or shred command to remove the temporary wallet files.&lt;br /&gt;
&lt;br /&gt;
Be sure to modify the script options to fit your setup. After you save, make sure the file can be executed properly by the cron user. Common permissions for files in /usr/local/bin/ can be applied using (verify with your distribution!):&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/bin/ &amp;amp;&amp;amp; chown root:root backupwallet.sh &amp;amp;&amp;amp; chmod 755 backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
&lt;br /&gt;
==Restore==&lt;br /&gt;
&lt;br /&gt;
Assuming your backup is recent enough that you haven&#039;t used up all of your key pool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:&lt;br /&gt;
* Quit bitcoin(d).&lt;br /&gt;
* Copy your backed up wallet.dat into your bitcoin profile directory.&lt;br /&gt;
* If copying into existing profile, delete file &#039;&#039;blkindex.dat&#039;&#039; and &#039;&#039;blk0001.dat&#039;&#039; to make the client re-scan the block chain.&lt;br /&gt;
And you&#039;ll be good as new.&lt;br /&gt;
&lt;br /&gt;
==Erasing Plain Text Wallets==&lt;br /&gt;
&lt;br /&gt;
A good practice is to keep at least two wallets, one as a &amp;quot;current account&amp;quot; for everyday transactions and one as a &amp;quot;savings account&amp;quot; where you store the majority of your Bitcoins.  &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;savings account&amp;quot; wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your &amp;quot;current account&amp;quot; wallet.&lt;br /&gt;
&lt;br /&gt;
In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will &#039;&#039;not&#039;&#039; generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.&lt;br /&gt;
&lt;br /&gt;
The Linux &#039;&#039;&#039;shred&#039;&#039;&#039; command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover.  Using shred (and similar tools on Windows) however does not guarantee that still other copies don&#039;t exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your  filesystem, duplicating your wallet.dat.&lt;br /&gt;
&lt;br /&gt;
In Mac OS, the equivalent of &#039;&#039;&#039;shred&#039;&#039;&#039; is &#039;&#039;&#039;srm&#039;&#039;&#039; (introduced in Leopard). Using the Finder to remove files, clicking &amp;quot;Secure Empty Trash&amp;quot; in the Finder menu will shred the contents of the trash can. As with any OS this doesn&#039;t guarantee that there are not other copies elsewhere on your system.&lt;br /&gt;
&lt;br /&gt;
For Windows, the built-in command &#039;&#039;cipher /W&#039;&#039; will shred all previously-deleted files. [http://www.cylog.org/utilities/cybershredder.jsp CyberShredder] can securely deleted individual files.&lt;br /&gt;
&lt;br /&gt;
==eWallet==&lt;br /&gt;
&lt;br /&gt;
Storing bitcoins with an [[eWallet]] provider incurs risks as well. Basically you grant the third party, in this case eWallet, full access to your wallet.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Data directory]]&lt;br /&gt;
* [http://startbitcoin.com/how-to-create-a-secure-bitcoin-wallet/ Secure Bitcoin Wallet Tutorial]&lt;br /&gt;
* [[How to set up a secure offline savings wallet]]&lt;br /&gt;
&lt;br /&gt;
[[de:Sichere deine Geldbörse]]&lt;br /&gt;
[[zh-cn:保护你的钱包]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12229</id>
		<title>Securing your wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12229"/>
		<updated>2011-07-02T01:13:00Z</updated>

		<summary type="html">&lt;p&gt;D-man97: /* Linux solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Wallet security can be broken down into two independent goals:&lt;br /&gt;
# Protecting your wallet against loss.&lt;br /&gt;
# Protecting your wallet against theft.&lt;br /&gt;
&lt;br /&gt;
In the case that your current wallet hasn&#039;t been protected adequately (e.g. put online with a weaker password):&lt;br /&gt;
# Making a new secure wallet, using appropriate long-term protection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For a brief overview see also: [[Wallet Security Dos and Don&#039;ts (Windows)|Wallet Security Dos and Don&#039;ts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Technical Background==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions send Bitcoins to a specific public key. A Bitcoin address is an encoded hash of a public key. In order to use received Bitcoins, you need to have the private key matching the public key you received with. This is sort of like a super long password associated with an account (public key). Your Bitcoin wallet contains all of the private keys necessary for spending your received transactions. If you delete your wallet without a backup, then you no longer have the authorization information necessary to claim your coins, and the coins associated with those keys are lost forever.&lt;br /&gt;
&lt;br /&gt;
The wallet contains a pool of queued keys. By default there are 100 keys in the [[key pool]].  The size of the pool is configurable using the &amp;quot;-keypool&amp;quot; command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.&lt;br /&gt;
&lt;br /&gt;
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.&lt;br /&gt;
&lt;br /&gt;
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient&#039;s public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.&lt;br /&gt;
&lt;br /&gt;
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.&lt;br /&gt;
&lt;br /&gt;
== Making a new wallet ==&lt;br /&gt;
&lt;br /&gt;
In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.&lt;br /&gt;
&lt;br /&gt;
For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised.  Just re-encrypting isn&#039;t secure.  One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).&lt;br /&gt;
&lt;br /&gt;
==Making a secure workspace==&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
The first step is to make a [http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/ new user,] so run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser new_user_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as root. When you get to the prompt &#039;Enter the new value, or press ENTER for the default&#039;, just keep hitting ENTER.&lt;br /&gt;
&lt;br /&gt;
Then switch user to the new user.  To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the &#039;System/Quit&#039; screen, or if there is no switch icon on your system you can log out and log back in as the new user.  Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.&lt;br /&gt;
&lt;br /&gt;
For secure browsing, open Firefox, and then go into the Edit menu and click Preferences.  Starting from the left, click on the General tab, and in the &#039;Startup/When Firefox starts&#039; pop up menu, choose &#039;Show a Blank Page&#039;.  Then click on the Content tab, and deselect &#039;Load images automatically&#039; and deselect &#039;Enable Javascript&#039;.  Then click on the Privacy tab, and in the &#039;History/Firefox will&#039; pop up menu, choose &#039;Never remember history&#039;.  Then click on the Security tab, and in the Passwords section, deselect &#039;Remember passwords for sites&#039; and deselect &#039;Use a master password&#039;.  Then click on the Advanced tab, then click on the Update tab, and then in the &#039;Automatically check for updates to&#039; section, deselect &#039;Add-ons&#039; and &#039;Search Engines&#039;.&lt;br /&gt;
&lt;br /&gt;
When javascript is disabled, the [http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.23/bitcoin-0.3.23-linux.tar.gz/download linux download page] will not download automatically, so you&#039;ll have to click on the &#039;direct link&#039; part of the &amp;quot;Problems with the download? Please use this &#039;direct link&#039; or try another mirror.&amp;quot; line.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve made your secure new user, to maintain security you should use it only for bitcoin.&lt;br /&gt;
&lt;br /&gt;
It&#039;s also a good idea to encrypt the Home directory of whatever user you run Bitcoin under using ecryptfs-utils. To do this:&lt;br /&gt;
# If the Home directory is not empty you should back it up first, by just copying the data to an external drive or something.&lt;br /&gt;
# install ecryptfs-utils (on Ubuntu: sudo apt-get install ecryptfs-utils)&lt;br /&gt;
# log out of X (graphical system) and press Ctrl+Alt+F1 to login to the command shell (you must be logged out or some files will be open and the tool won&#039;t be able to encrypt your data)&lt;br /&gt;
# change directory to something that&#039;s not in your home folder (ex: cd / )&lt;br /&gt;
# run the migration tool (on Ubuntu: sudo ecryptfs-migrate-home -u username)&lt;br /&gt;
# if it&#039;s successful, you can now press ALT+F8 to go back to the GUI and login&lt;br /&gt;
# run &#039;ecryptfs-unwrap-passphrase&#039; and &#039;&#039;&#039;WRITE DOWN OR SAVE THE CODE IT RETURNS&#039;&#039;&#039; because you will need it if you ever have to pull your data off while the OS is not working. (You can run it again later if you need to, but run it now so that you can get your data if your Linux install gets botched.)&lt;br /&gt;
# run &#039;ecryptfs-setup-swap&#039; to encrypt your swap partition (the encrypted folder data is not encrypted while it&#039;s in memory, and so if it&#039;s ever sent to the swap partition it can be stolen from there unless that too is encrypted - be aware that this will mean you cannot use Hibernate anymore, as the bootloader won&#039;t be able to restore the hibernation data)&lt;br /&gt;
(instructions from [http://bodhizazen.net/Tutorials/Ecryptfs/#Migrate])&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
=====Backup all data (500MB)=====&lt;br /&gt;
Follow these instructions to backup all the bitcoin data (wallet and block chains) to an encrypted disk image.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 500MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move everything from ~/Library/Application Support/Bitcoin/ to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin ~/Library/Application Support/Bitcoin&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
=====Backup just wallet.dat (40MB)=====&lt;br /&gt;
Follow these instructions to backup just the wallet.dat file. This results in a smaller disk image, but it&#039;s more complicated to do.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 40MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move your wallet.dat file to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin/wallet.dat ~/Library/Application Support/Bitcoin/wallet.dat&lt;br /&gt;
&lt;br /&gt;
[[File:MountWalletAndLauchnBitcoin_OSX_Automator.png|thumbnail|150px|Mount Wallet and launch Bitcoin]]&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you start the Bitcoin application without having the image mounted, the application will overwrite your symlink with a new wallet. If that happens, don&#039;t panic. Just delete the new wallet.dat, mount the image, and recreate the symlink like above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Automation&#039;&#039;&#039;: You can create a small application using [http://en.wikipedia.org/wiki/Automator_%28software%29 Automator] (included in OS X) to automatically mount the wallet and then launch Bitcoin App. See the Screenshot on how to do this.&lt;br /&gt;
&lt;br /&gt;
If one &#039;&#039;doesn&#039;t&#039;&#039; want to use encrypted Disk images, then a &#039;&#039;&#039;small shell script&#039;&#039;&#039; can be used instead that takes care of decrypting the wallet, launching bitcoin client, and encrypting it after the client exits. This script works on both OSX and Linux: [http://lorelei.kaverit.org/bitcoin.sh bitcoin-launch-script]&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
If you are using Windows XP or Windows 7, you can keep your wallet on an encrypted disk image created by third-party software, such as [http://www.truecrypt.org/ TrueCrypt] (open source) or [http://www.jetico.com/encryption-bestcrypt/ Jetico BestCrypt] (commercial).  You can probably do the same with Windows Vista or Windows 2000.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You should configure BitCoin in this manner only on computers where you use BitCoin, but do not use that computer to mine.  For example, this is a good configuration for a notebook or tablet computer.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have installed the Windows BitCoin client and run it at least once, the process is described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;To mount the BitCoin data directory on an encrypted drive&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol start=1 type=1&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the third-party disk image encryption program of your choice to create and mount an encrypted disk image of at least 100 MB in size.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Locate the BitCoin data directory, and copy the directory with all contents to the encrypted drive.&lt;br /&gt;
&amp;lt;p&amp;gt;For help finding this directory, see &amp;lt;b&amp;gt;[[Securing_your_wallet#Locating_BitCoin_s_data_directory|Locating BitCoin&#039;s Data Directory]]&amp;lt;/b&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a Windows shortcut that starts BitCoin with the &amp;lt;code&amp;gt;-datadir&amp;lt;/code&amp;gt; parameter and specifies the encrypted drive and directory.&lt;br /&gt;
&amp;lt;p&amp;gt;For example, if you installed Bitcoin in the default directory, mounted your BitCoin encrypted drive as &amp;lt;code&amp;gt;E:\&amp;lt;/code&amp;gt;, and stored your BitCoin data directory on it as &amp;lt;code&amp;gt;Bitcoin&amp;lt;/code&amp;gt;, you would type the following command as the shortcut Target:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;C:\Program Files\Bitcoin\bitcoin.exe -datadir=E:\Bitcoin&amp;lt;/code&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open BitCoin&#039;s settings and configure it &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; to start automatically when you start Windows.&lt;br /&gt;
&amp;lt;p&amp;gt;This is to allow you to mount the BitCoin encrypted disk image before starting BitCoin.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Shut down BitCoin, and then restart it from the new shortcut.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After doing this, any time you want to use BitCoin, you must first mount the BitCoin encrypted disk image using the same drive designation, and then run BitCoin from the shortcut that you created, so that it can find its data and your wallet. :-)&lt;br /&gt;
&lt;br /&gt;
== Locating BitCoin&#039;s data directory ==&lt;br /&gt;
&lt;br /&gt;
The [[data directory]] is the location where Bitcoin&#039;s data files are stored, including the wallet data file.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
Go to Start -&amp;gt; Run (or press WinKey+R) and run this:&lt;br /&gt;
&lt;br /&gt;
 explorer %APPDATA%\BitCoin&lt;br /&gt;
&lt;br /&gt;
BitCoin&#039;s data folder will open. For most users, this is the following locations:&lt;br /&gt;
&lt;br /&gt;
 C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)&lt;br /&gt;
 &lt;br /&gt;
 C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;AppData&amp;quot; and &amp;quot;Application data&amp;quot; are hidden by default.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/.bitcoin/&lt;br /&gt;
&lt;br /&gt;
You need to do a &amp;quot;ls -a&amp;quot; to see directories that start with a dot.&lt;br /&gt;
&lt;br /&gt;
If that&#039;s not it, you can do a search like this:&lt;br /&gt;
&lt;br /&gt;
 find / -name wallet.dat -print 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/Library/Application Support/Bitcoin/&lt;br /&gt;
&lt;br /&gt;
==Backup==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: I would strongly recommend against using Dropbox to back up your Bitcoin data due to [http://en.wikipedia.org/wiki/Dropbox_(service)#Criticism security concerns] such as:&lt;br /&gt;
# the fact that they store your encryption key (meaning that a disgruntled Dropbox employee or an attacker who gained access to the system could decrypt your Dropbox data and steal your Bitcoins)&lt;br /&gt;
# the fact that the Dropbox client only needs a password for the first login. After it authenticates once, the server assigns it a token which it uses to show that, at one time, its user knew the password rather than sending the actual password (meaning that if you ever use the Dropbox client on another PC, that PC&#039;s users can access your Dropbox - even if you change your password - and can steal your Bitcoins or get a virus that will steal your Bitcoins).&lt;br /&gt;
&lt;br /&gt;
For these reasons, I personally prefer to use Wuala, which does not store your encryption key and requires a password each time (the client can be set to remember your password, but the server will check each time to make sure that the client is sending the correct password). Like Dropbox, the basic, lowest-storage-space account with Wuala is free of charge, and coincidentally, Wuala [http://www.wuala.com/en/bitcoin is experimenting with allowing users to pay for &amp;quot;upgraded&amp;quot; plans using Bitcoin.]&lt;br /&gt;
&lt;br /&gt;
In fact, whether you use Dropbox as your backup or not, use what Steve Gibson calls &amp;quot;pre-Internet encryption&amp;quot; (which he actually [http://itknowledgeexchange.techtarget.com/security-corner/cloud-security-and-privacy-do-they-exist/ discussed in the context of Dropbox&#039;s security concerns]) and use some form of encryption on the files before you back them up, just in case someone other than yourself ever gains access to that backup. Make sure to pick a password that&#039;s memorable but secure.&lt;br /&gt;
&lt;br /&gt;
The only file you need to back up is &amp;quot;wallet.dat&amp;quot;. Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.&lt;br /&gt;
&lt;br /&gt;
You can use the [[api|backupwallet]] JSON-RPC command to back up without shutting down Bitcoin.&lt;br /&gt;
&lt;br /&gt;
=== General Solutions ===&lt;br /&gt;
&lt;br /&gt;
Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.&lt;br /&gt;
* [http://www.7-zip.org/ 7-zip] - Supports strongly-encrypted archives.&lt;br /&gt;
* [http://www.axantum.com/axcrypt/ AxCrypt]&lt;br /&gt;
* [http://lrzip.kolivas.org lrzip] - Compression software for Linux and OSX that supports very high grade password protected encryption&lt;br /&gt;
* [http://www.truecrypt.org/ TrueCrypt] - Volume-based on-the-fly encryption (for advanced users)&lt;br /&gt;
* [http://www.rarlab.com/ WinRar] - Commonly used archive software that supports verification records and encryption.&lt;br /&gt;
&lt;br /&gt;
There is also a list of [[OpenSourceEncryptionSoftware|open source encryption software.]]&lt;br /&gt;
&lt;br /&gt;
Decrypting and encrypting the wallet.dat every time you start or quit the Bitcoin client can be &#039;&#039;tedious&#039;&#039; (and outright error-prone). If you want to keep your wallet encrypted (except while you&#039;re actually running the Bitcoin client), it&#039;s better to relegate the automation to a [http://lorelei.kaverit.org/bitcoin.sh small shell script] that handles the en/decryption and starting up Bitcoin client for you (Linux and OSX). &lt;br /&gt;
&lt;br /&gt;
There is also a method to Print out and encrypt your Wallet.dat as a special barcode. See details here: [[WalletPaperbackup]]&lt;br /&gt;
&lt;br /&gt;
==== Password Strength ====&lt;br /&gt;
Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is &#039;&#039;&#039;at least&#039;&#039;&#039; 12 characters long.  You can also use a multi-word password. [http://www.baekdal.com/tips/password-security-usability The Usability of Passwords] &lt;br /&gt;
&lt;br /&gt;
However, simply using dictionary words is also insecure as it opens you up to a dictionary attack. If you use dictionary words, be sure to throw random symbols and numbers in the mix as well.&lt;br /&gt;
&lt;br /&gt;
A good way to create secure but easy-to-remember passwords is to pick a password (ex: d0g) and pad it with a good number of repeated characters afterward (such as 10 $ signs - so d0g becomes d0g$$$$$$$$$$) - this is just as cryptographically secure as a random password of equal length so long as the attacker does not know which symbol you are following your &amp;quot;word&amp;quot; with and how many times it is repeated. ([https://www.grc.com/haystack.htm source])&lt;br /&gt;
&lt;br /&gt;
If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.&lt;br /&gt;
&lt;br /&gt;
Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.&lt;br /&gt;
&lt;br /&gt;
===== Choosing Your Password =====&lt;br /&gt;
Make sure you pick at least one character in each group:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Lowercase: abcdefghijklmnopqrstuvwxyz&lt;br /&gt;
  Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;br /&gt;
  Number: 1234567890&lt;br /&gt;
  Symbol: `~!@#$%^&amp;amp;*()-_=+\|[{]};:&#039;&amp;quot;,&amp;lt;.&amp;gt;/? (space)&lt;br /&gt;
  &lt;br /&gt;
  09 char = insecure&lt;br /&gt;
  10 char = low security&lt;br /&gt;
  11 char = medium security&lt;br /&gt;
  12 char = good security (good enough for your wallet)&lt;br /&gt;
  13 char = v.good enough for anything.&lt;br /&gt;
&lt;br /&gt;
==== Storage of Archive ====&lt;br /&gt;
One of the most simple methods for storing a appropriately &#039;&#039;&#039;encrypted&#039;&#039;&#039; archive of your wallet.dat file is to send the archive as an email attachment to your own e-mail address.  Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely.  One can even obfuscate the name of the files within the archive, and name the archive something less inviting, such as: &#039;personal notes&#039; or &#039;car insurance&#039;.&lt;br /&gt;
&lt;br /&gt;
Another solution is to use a file storage service like [http://www.wuala.com/bitcoin Wuala] ( encrypted, [http://www.bitcoin.org/smf/index.php?topic=5817.0 instructions]), [http://www.dropbox.com Dropbox] and [http://en.wikipedia.org/wiki/Comparison_of_online_backup_services others], including the more secure [http://www.spideroak.com SpiderOak].&lt;br /&gt;
&lt;br /&gt;
=== Linux solution ===&lt;br /&gt;
&lt;br /&gt;
Linux users can setup backups using cron by telling it to run a backup script at set intervals of time. Run &#039;crontab -e&#039; and add this line near the bottom:&lt;br /&gt;
&lt;br /&gt;
 01 */1 * * * /usr/local/bin/backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
This cron line will run the /usr/local/bin/backupwallet.sh script at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won&#039;t run.&lt;br /&gt;
&lt;br /&gt;
Create backupwallet.sh:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # /usr/local/bin/backupwallet.sh&lt;br /&gt;
 #&lt;br /&gt;
 # Performs backup of bitcoin wallet.&lt;br /&gt;
 #&lt;br /&gt;
 # Written by: https://en.bitcoin.it/wiki/Securing_your_wallet&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Standard Options&lt;br /&gt;
 #&lt;br /&gt;
 TS=$(date &amp;quot;+%Y%m%d-%H%M&amp;quot;)&lt;br /&gt;
 WALLET=/tmp/wallet${TS}&lt;br /&gt;
 WALLET_E=/tmp/wallet${TS}.crypt&lt;br /&gt;
 USERNAME=username  # Update to your bitcoin Linux username.&lt;br /&gt;
 RM=rm&lt;br /&gt;
 RM_OPTS=--force&lt;br /&gt;
 USE_SHRED=0  # Flip to 1 to use `shred` instead of `rm`.&lt;br /&gt;
 SHRED=shred&lt;br /&gt;
 SHRED_OPTS=--force --iterations=9 --zero --remove&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Storage Options&lt;br /&gt;
 # Only 1 option should be un-commented (the last one will be used).&lt;br /&gt;
 # Update CP_DEST paths as neccessary.&lt;br /&gt;
 #&lt;br /&gt;
 # CP - Storage on a local (or networked) machine. Could be Dropbox/Wuala folder.&lt;br /&gt;
 #CP=cp&lt;br /&gt;
 #CP_DEST=smb://machine/share/folder/  # /var/data/backups/, ~/Dropbox/, etc.&lt;br /&gt;
 #&lt;br /&gt;
 # SSH - Storage on a remote machine.&lt;br /&gt;
 CP=scp&lt;br /&gt;
 CP_DEST=&amp;quot;remoteuser@example.com:~/wallets/&amp;quot;&lt;br /&gt;
 #&lt;br /&gt;
 # S3 - Storage on Amazon&#039;s S3. Be sure s3cmd is installed and properly setup.&lt;br /&gt;
 # You may need &amp;quot;s3cmd put --force&amp;quot; if you use a sub-directory in CP_DEST.&lt;br /&gt;
 #CP=s3cmd put&lt;br /&gt;
 #CP_DEST=s3://bucket&lt;br /&gt;
 &lt;br /&gt;
 do_clean() {&lt;br /&gt;
   # Remove temporary wallets.&lt;br /&gt;
   if [ 1 -eq $USE_SHRED ]; then&lt;br /&gt;
     $SHRED $SHRED_OPTS $WALLET $WALLET_E&lt;br /&gt;
   else&lt;br /&gt;
     $RM $RM_OPTS $WALLET $WALLET_E&lt;br /&gt;
   fi&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 do_fail() {&lt;br /&gt;
   echo failed!&lt;br /&gt;
   do_clean&lt;br /&gt;
   exit 1&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 # Perform the backup.&lt;br /&gt;
 echo -n Making backup...&lt;br /&gt;
 bitcoind backupwallet $WALLET&lt;br /&gt;
 [ ! -s &amp;quot;$WALLET&amp;quot; ] &amp;amp;&amp;amp; do_fail  # If the backup does not exist or is empty, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Encrypting backup....&lt;br /&gt;
 gpg -r $USERNAME --output $WALLET_E --encrypt $WALLET&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If gpg returned a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 echo -n Copying to backup location...&lt;br /&gt;
 $CP $WALLET_E $CP_DEST&lt;br /&gt;
 [ 0 -ne $? ] &amp;amp;&amp;amp; do_fail  # If the $CP command returns a non-zero result, fail.&lt;br /&gt;
 echo done.&lt;br /&gt;
 do_clean&lt;br /&gt;
 &lt;br /&gt;
 exit 0&lt;br /&gt;
&lt;br /&gt;
The shell script:&lt;br /&gt;
&lt;br /&gt;
* Calls bitcoind backupwallet to create a time/date-stamped wallet.&lt;br /&gt;
* GPG encrypts the wallet with your public key.&lt;br /&gt;
* Copies the result using one of several storage options (cp, scp, and s3cmd).&lt;br /&gt;
* Uses the rm or shred command to remove the temporary wallet files.&lt;br /&gt;
&lt;br /&gt;
Be sure to modify the script options to fit your setup. After you save, make sure the file can be executed properly by the cron user. Common permissions for files in /usr/local/bin/ can be applied using (verify with your distribution!):&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/bin/ &amp;amp;&amp;amp; chown root:root backupwallet.sh &amp;amp;&amp;amp; chmod 755 backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
&lt;br /&gt;
==Restore==&lt;br /&gt;
&lt;br /&gt;
Assuming your backup is recent enough that you haven&#039;t used up all of your key pool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:&lt;br /&gt;
* Quit bitcoin(d).&lt;br /&gt;
* Copy your backed up wallet.dat into your bitcoin profile directory.&lt;br /&gt;
* If copying into existing profile, delete file &#039;&#039;blkindex.dat&#039;&#039; and &#039;&#039;blk0001.dat&#039;&#039; to make the client re-scan the block chain.&lt;br /&gt;
And you&#039;ll be good as new.&lt;br /&gt;
&lt;br /&gt;
==Erasing Plain Text Wallets==&lt;br /&gt;
&lt;br /&gt;
A good practice is to keep at least two wallets, one as a &amp;quot;current account&amp;quot; for everyday transactions and one as a &amp;quot;savings account&amp;quot; where you store the majority of your Bitcoins.  &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;savings account&amp;quot; wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your &amp;quot;current account&amp;quot; wallet.&lt;br /&gt;
&lt;br /&gt;
In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will &#039;&#039;not&#039;&#039; generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.&lt;br /&gt;
&lt;br /&gt;
The Linux &#039;&#039;&#039;shred&#039;&#039;&#039; command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover.  Using shred (and similar tools on Windows) however does not guarantee that still other copies don&#039;t exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your  filesystem, duplicating your wallet.dat.&lt;br /&gt;
&lt;br /&gt;
In Mac OS, the equivalent of &#039;&#039;&#039;shred&#039;&#039;&#039; is &#039;&#039;&#039;srm&#039;&#039;&#039; (introduced in Leopard). Using the Finder to remove files, clicking &amp;quot;Secure Empty Trash&amp;quot; in the Finder menu will shred the contents of the trash can. As with any OS this doesn&#039;t guarantee that there are not other copies elsewhere on your system.&lt;br /&gt;
&lt;br /&gt;
For Windows, the built-in command &#039;&#039;cipher /W&#039;&#039; will shred all previously-deleted files. [http://www.cylog.org/utilities/cybershredder.jsp CyberShredder] can securely deleted individual files.&lt;br /&gt;
&lt;br /&gt;
==eWallet==&lt;br /&gt;
&lt;br /&gt;
Storing bitcoins with an [[eWallet]] provider incurs risks as well. Basically you grant the third party, in this case eWallet, full access to your wallet.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Data directory]]&lt;br /&gt;
* [http://startbitcoin.com/how-to-create-a-secure-bitcoin-wallet/ Secure Bitcoin Wallet Tutorial]&lt;br /&gt;
* [[How to set up a secure offline savings wallet]]&lt;br /&gt;
&lt;br /&gt;
[[de:Sichere deine Geldbörse]]&lt;br /&gt;
[[zh-cn:保护你的钱包]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12228</id>
		<title>Securing your wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12228"/>
		<updated>2011-07-02T00:30:51Z</updated>

		<summary type="html">&lt;p&gt;D-man97: /* Linux solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Wallet security can be broken down into two independent goals:&lt;br /&gt;
# Protecting your wallet against loss.&lt;br /&gt;
# Protecting your wallet against theft.&lt;br /&gt;
&lt;br /&gt;
In the case that your current wallet hasn&#039;t been protected adequately (e.g. put online with a weaker password):&lt;br /&gt;
# Making a new secure wallet, using appropriate long-term protection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For a brief overview see also: [[Wallet Security Dos and Don&#039;ts (Windows)|Wallet Security Dos and Don&#039;ts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Technical Background==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions send Bitcoins to a specific public key. A Bitcoin address is an encoded hash of a public key. In order to use received Bitcoins, you need to have the private key matching the public key you received with. This is sort of like a super long password associated with an account (public key). Your Bitcoin wallet contains all of the private keys necessary for spending your received transactions. If you delete your wallet without a backup, then you no longer have the authorization information necessary to claim your coins, and the coins associated with those keys are lost forever.&lt;br /&gt;
&lt;br /&gt;
The wallet contains a pool of queued keys. By default there are 100 keys in the [[key pool]].  The size of the pool is configurable using the &amp;quot;-keypool&amp;quot; command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.&lt;br /&gt;
&lt;br /&gt;
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.&lt;br /&gt;
&lt;br /&gt;
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient&#039;s public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.&lt;br /&gt;
&lt;br /&gt;
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.&lt;br /&gt;
&lt;br /&gt;
== Making a new wallet ==&lt;br /&gt;
&lt;br /&gt;
In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.&lt;br /&gt;
&lt;br /&gt;
For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised.  Just re-encrypting isn&#039;t secure.  One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).&lt;br /&gt;
&lt;br /&gt;
==Making a secure workspace==&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
The first step is to make a [http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/ new user,] so run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser new_user_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as root. When you get to the prompt &#039;Enter the new value, or press ENTER for the default&#039;, just keep hitting ENTER.&lt;br /&gt;
&lt;br /&gt;
Then switch user to the new user.  To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the &#039;System/Quit&#039; screen, or if there is no switch icon on your system you can log out and log back in as the new user.  Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.&lt;br /&gt;
&lt;br /&gt;
For secure browsing, open Firefox, and then go into the Edit menu and click Preferences.  Starting from the left, click on the General tab, and in the &#039;Startup/When Firefox starts&#039; pop up menu, choose &#039;Show a Blank Page&#039;.  Then click on the Content tab, and deselect &#039;Load images automatically&#039; and deselect &#039;Enable Javascript&#039;.  Then click on the Privacy tab, and in the &#039;History/Firefox will&#039; pop up menu, choose &#039;Never remember history&#039;.  Then click on the Security tab, and in the Passwords section, deselect &#039;Remember passwords for sites&#039; and deselect &#039;Use a master password&#039;.  Then click on the Advanced tab, then click on the Update tab, and then in the &#039;Automatically check for updates to&#039; section, deselect &#039;Add-ons&#039; and &#039;Search Engines&#039;.&lt;br /&gt;
&lt;br /&gt;
When javascript is disabled, the [http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.23/bitcoin-0.3.23-linux.tar.gz/download linux download page] will not download automatically, so you&#039;ll have to click on the &#039;direct link&#039; part of the &amp;quot;Problems with the download? Please use this &#039;direct link&#039; or try another mirror.&amp;quot; line.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve made your secure new user, to maintain security you should use it only for bitcoin.&lt;br /&gt;
&lt;br /&gt;
It&#039;s also a good idea to encrypt the Home directory of whatever user you run Bitcoin under using ecryptfs-utils. To do this:&lt;br /&gt;
# If the Home directory is not empty you should back it up first, by just copying the data to an external drive or something.&lt;br /&gt;
# install ecryptfs-utils (on Ubuntu: sudo apt-get install ecryptfs-utils)&lt;br /&gt;
# log out of X (graphical system) and press Ctrl+Alt+F1 to login to the command shell (you must be logged out or some files will be open and the tool won&#039;t be able to encrypt your data)&lt;br /&gt;
# change directory to something that&#039;s not in your home folder (ex: cd / )&lt;br /&gt;
# run the migration tool (on Ubuntu: sudo ecryptfs-migrate-home -u username)&lt;br /&gt;
# if it&#039;s successful, you can now press ALT+F8 to go back to the GUI and login&lt;br /&gt;
# run &#039;ecryptfs-unwrap-passphrase&#039; and &#039;&#039;&#039;WRITE DOWN OR SAVE THE CODE IT RETURNS&#039;&#039;&#039; because you will need it if you ever have to pull your data off while the OS is not working. (You can run it again later if you need to, but run it now so that you can get your data if your Linux install gets botched.)&lt;br /&gt;
# run &#039;ecryptfs-setup-swap&#039; to encrypt your swap partition (the encrypted folder data is not encrypted while it&#039;s in memory, and so if it&#039;s ever sent to the swap partition it can be stolen from there unless that too is encrypted - be aware that this will mean you cannot use Hibernate anymore, as the bootloader won&#039;t be able to restore the hibernation data)&lt;br /&gt;
(instructions from [http://bodhizazen.net/Tutorials/Ecryptfs/#Migrate])&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
=====Backup all data (500MB)=====&lt;br /&gt;
Follow these instructions to backup all the bitcoin data (wallet and block chains) to an encrypted disk image.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 500MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move everything from ~/Library/Application Support/Bitcoin/ to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin ~/Library/Application Support/Bitcoin&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
=====Backup just wallet.dat (40MB)=====&lt;br /&gt;
Follow these instructions to backup just the wallet.dat file. This results in a smaller disk image, but it&#039;s more complicated to do.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 40MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move your wallet.dat file to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin/wallet.dat ~/Library/Application Support/Bitcoin/wallet.dat&lt;br /&gt;
&lt;br /&gt;
[[File:MountWalletAndLauchnBitcoin_OSX_Automator.png|thumbnail|150px|Mount Wallet and launch Bitcoin]]&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you start the Bitcoin application without having the image mounted, the application will overwrite your symlink with a new wallet. If that happens, don&#039;t panic. Just delete the new wallet.dat, mount the image, and recreate the symlink like above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Automation&#039;&#039;&#039;: You can create a small application using [http://en.wikipedia.org/wiki/Automator_%28software%29 Automator] (included in OS X) to automatically mount the wallet and then launch Bitcoin App. See the Screenshot on how to do this.&lt;br /&gt;
&lt;br /&gt;
If one &#039;&#039;doesn&#039;t&#039;&#039; want to use encrypted Disk images, then a &#039;&#039;&#039;small shell script&#039;&#039;&#039; can be used instead that takes care of decrypting the wallet, launching bitcoin client, and encrypting it after the client exits. This script works on both OSX and Linux: [http://lorelei.kaverit.org/bitcoin.sh bitcoin-launch-script]&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
If you are using Windows XP or Windows 7, you can keep your wallet on an encrypted disk image created by third-party software, such as [http://www.truecrypt.org/ TrueCrypt] (open source) or [http://www.jetico.com/encryption-bestcrypt/ Jetico BestCrypt] (commercial).  You can probably do the same with Windows Vista or Windows 2000.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You should configure BitCoin in this manner only on computers where you use BitCoin, but do not use that computer to mine.  For example, this is a good configuration for a notebook or tablet computer.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have installed the Windows BitCoin client and run it at least once, the process is described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;To mount the BitCoin data directory on an encrypted drive&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol start=1 type=1&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the third-party disk image encryption program of your choice to create and mount an encrypted disk image of at least 100 MB in size.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Locate the BitCoin data directory, and copy the directory with all contents to the encrypted drive.&lt;br /&gt;
&amp;lt;p&amp;gt;For help finding this directory, see &amp;lt;b&amp;gt;[[Securing_your_wallet#Locating_BitCoin_s_data_directory|Locating BitCoin&#039;s Data Directory]]&amp;lt;/b&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a Windows shortcut that starts BitCoin with the &amp;lt;code&amp;gt;-datadir&amp;lt;/code&amp;gt; parameter and specifies the encrypted drive and directory.&lt;br /&gt;
&amp;lt;p&amp;gt;For example, if you installed Bitcoin in the default directory, mounted your BitCoin encrypted drive as &amp;lt;code&amp;gt;E:\&amp;lt;/code&amp;gt;, and stored your BitCoin data directory on it as &amp;lt;code&amp;gt;Bitcoin&amp;lt;/code&amp;gt;, you would type the following command as the shortcut Target:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;C:\Program Files\Bitcoin\bitcoin.exe -datadir=E:\Bitcoin&amp;lt;/code&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open BitCoin&#039;s settings and configure it &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; to start automatically when you start Windows.&lt;br /&gt;
&amp;lt;p&amp;gt;This is to allow you to mount the BitCoin encrypted disk image before starting BitCoin.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Shut down BitCoin, and then restart it from the new shortcut.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After doing this, any time you want to use BitCoin, you must first mount the BitCoin encrypted disk image using the same drive designation, and then run BitCoin from the shortcut that you created, so that it can find its data and your wallet. :-)&lt;br /&gt;
&lt;br /&gt;
== Locating BitCoin&#039;s data directory ==&lt;br /&gt;
&lt;br /&gt;
The [[data directory]] is the location where Bitcoin&#039;s data files are stored, including the wallet data file.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
Go to Start -&amp;gt; Run (or press WinKey+R) and run this:&lt;br /&gt;
&lt;br /&gt;
 explorer %APPDATA%\BitCoin&lt;br /&gt;
&lt;br /&gt;
BitCoin&#039;s data folder will open. For most users, this is the following locations:&lt;br /&gt;
&lt;br /&gt;
 C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)&lt;br /&gt;
 &lt;br /&gt;
 C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;AppData&amp;quot; and &amp;quot;Application data&amp;quot; are hidden by default.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/.bitcoin/&lt;br /&gt;
&lt;br /&gt;
You need to do a &amp;quot;ls -a&amp;quot; to see directories that start with a dot.&lt;br /&gt;
&lt;br /&gt;
If that&#039;s not it, you can do a search like this:&lt;br /&gt;
&lt;br /&gt;
 find / -name wallet.dat -print 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/Library/Application Support/Bitcoin/&lt;br /&gt;
&lt;br /&gt;
==Backup==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: I would strongly recommend against using Dropbox to back up your Bitcoin data due to [http://en.wikipedia.org/wiki/Dropbox_(service)#Criticism security concerns] such as:&lt;br /&gt;
# the fact that they store your encryption key (meaning that a disgruntled Dropbox employee or an attacker who gained access to the system could decrypt your Dropbox data and steal your Bitcoins)&lt;br /&gt;
# the fact that the Dropbox client only needs a password for the first login. After it authenticates once, the server assigns it a token which it uses to show that, at one time, its user knew the password rather than sending the actual password (meaning that if you ever use the Dropbox client on another PC, that PC&#039;s users can access your Dropbox - even if you change your password - and can steal your Bitcoins or get a virus that will steal your Bitcoins).&lt;br /&gt;
&lt;br /&gt;
For these reasons, I personally prefer to use Wuala, which does not store your encryption key and requires a password each time (the client can be set to remember your password, but the server will check each time to make sure that the client is sending the correct password). Like Dropbox, the basic, lowest-storage-space account with Wuala is free of charge, and coincidentally, Wuala [http://www.wuala.com/en/bitcoin is experimenting with allowing users to pay for &amp;quot;upgraded&amp;quot; plans using Bitcoin.]&lt;br /&gt;
&lt;br /&gt;
In fact, whether you use Dropbox as your backup or not, use what Steve Gibson calls &amp;quot;pre-Internet encryption&amp;quot; (which he actually [http://itknowledgeexchange.techtarget.com/security-corner/cloud-security-and-privacy-do-they-exist/ discussed in the context of Dropbox&#039;s security concerns]) and use some form of encryption on the files before you back them up, just in case someone other than yourself ever gains access to that backup. Make sure to pick a password that&#039;s memorable but secure.&lt;br /&gt;
&lt;br /&gt;
The only file you need to back up is &amp;quot;wallet.dat&amp;quot;. Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.&lt;br /&gt;
&lt;br /&gt;
You can use the [[api|backupwallet]] JSON-RPC command to back up without shutting down Bitcoin.&lt;br /&gt;
&lt;br /&gt;
=== General Solutions ===&lt;br /&gt;
&lt;br /&gt;
Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.&lt;br /&gt;
* [http://www.7-zip.org/ 7-zip] - Supports strongly-encrypted archives.&lt;br /&gt;
* [http://www.axantum.com/axcrypt/ AxCrypt]&lt;br /&gt;
* [http://lrzip.kolivas.org lrzip] - Compression software for Linux and OSX that supports very high grade password protected encryption&lt;br /&gt;
* [http://www.truecrypt.org/ TrueCrypt] - Volume-based on-the-fly encryption (for advanced users)&lt;br /&gt;
* [http://www.rarlab.com/ WinRar] - Commonly used archive software that supports verification records and encryption.&lt;br /&gt;
&lt;br /&gt;
There is also a list of [[OpenSourceEncryptionSoftware|open source encryption software.]]&lt;br /&gt;
&lt;br /&gt;
Decrypting and encrypting the wallet.dat every time you start or quit the Bitcoin client can be &#039;&#039;tedious&#039;&#039; (and outright error-prone). If you want to keep your wallet encrypted (except while you&#039;re actually running the Bitcoin client), it&#039;s better to relegate the automation to a [http://lorelei.kaverit.org/bitcoin.sh small shell script] that handles the en/decryption and starting up Bitcoin client for you (Linux and OSX). &lt;br /&gt;
&lt;br /&gt;
There is also a method to Print out and encrypt your Wallet.dat as a special barcode. See details here: [[WalletPaperbackup]]&lt;br /&gt;
&lt;br /&gt;
==== Password Strength ====&lt;br /&gt;
Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is &#039;&#039;&#039;at least&#039;&#039;&#039; 12 characters long.  You can also use a multi-word password. [http://www.baekdal.com/tips/password-security-usability The Usability of Passwords] &lt;br /&gt;
&lt;br /&gt;
However, simply using dictionary words is also insecure as it opens you up to a dictionary attack. If you use dictionary words, be sure to throw random symbols and numbers in the mix as well.&lt;br /&gt;
&lt;br /&gt;
A good way to create secure but easy-to-remember passwords is to pick a password (ex: d0g) and pad it with a good number of repeated characters afterward (such as 10 $ signs - so d0g becomes d0g$$$$$$$$$$) - this is just as cryptographically secure as a random password of equal length so long as the attacker does not know which symbol you are following your &amp;quot;word&amp;quot; with and how many times it is repeated. ([https://www.grc.com/haystack.htm source])&lt;br /&gt;
&lt;br /&gt;
If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.&lt;br /&gt;
&lt;br /&gt;
Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.&lt;br /&gt;
&lt;br /&gt;
===== Choosing Your Password =====&lt;br /&gt;
Make sure you pick at least one character in each group:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Lowercase: abcdefghijklmnopqrstuvwxyz&lt;br /&gt;
  Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;br /&gt;
  Number: 1234567890&lt;br /&gt;
  Symbol: `~!@#$%^&amp;amp;*()-_=+\|[{]};:&#039;&amp;quot;,&amp;lt;.&amp;gt;/? (space)&lt;br /&gt;
  &lt;br /&gt;
  09 char = insecure&lt;br /&gt;
  10 char = low security&lt;br /&gt;
  11 char = medium security&lt;br /&gt;
  12 char = good security (good enough for your wallet)&lt;br /&gt;
  13 char = v.good enough for anything.&lt;br /&gt;
&lt;br /&gt;
==== Storage of Archive ====&lt;br /&gt;
One of the most simple methods for storing a appropriately &#039;&#039;&#039;encrypted&#039;&#039;&#039; archive of your wallet.dat file is to send the archive as an email attachment to your own e-mail address.  Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely.  One can even obfuscate the name of the files within the archive, and name the archive something less inviting, such as: &#039;personal notes&#039; or &#039;car insurance&#039;.&lt;br /&gt;
&lt;br /&gt;
Another solution is to use a file storage service like [http://www.wuala.com/bitcoin Wuala] ( encrypted, [http://www.bitcoin.org/smf/index.php?topic=5817.0 instructions]), [http://www.dropbox.com Dropbox] and [http://en.wikipedia.org/wiki/Comparison_of_online_backup_services others], including the more secure [http://www.spideroak.com SpiderOak].&lt;br /&gt;
&lt;br /&gt;
=== Linux solution ===&lt;br /&gt;
&lt;br /&gt;
Linux users can setup backups using cron by telling it to run a backup script at set intervals of time. Run &#039;crontab -e&#039; and add this line near the bottom:&lt;br /&gt;
&lt;br /&gt;
 01 */1 * * * /usr/local/bin/backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
This cron line will run the /usr/local/bin/backupwallet.sh script at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won&#039;t run.&lt;br /&gt;
&lt;br /&gt;
Create backupwallet.sh:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # /usr/local/bin/backupwallet.sh&lt;br /&gt;
 #&lt;br /&gt;
 # Performs backup of bitcoin wallet.&lt;br /&gt;
 #&lt;br /&gt;
 # Written by: https://en.bitcoin.it/wiki/Securing_your_wallet&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Standard Options&lt;br /&gt;
 #&lt;br /&gt;
 TS=$(date &amp;quot;+%Y%m%d-%H%M&amp;quot;)&lt;br /&gt;
 WALLET=/tmp/wallet${TS}&lt;br /&gt;
 WALLET_E=/tmp/wallet${TS}.crypt&lt;br /&gt;
 USERNAME=username  # Update to your bitcoin Linux username.&lt;br /&gt;
 RM=rm&lt;br /&gt;
 RM_OPTS=--force&lt;br /&gt;
 USE_SHRED=0  # Flip to 1 to use `shred` instead of `rm`.&lt;br /&gt;
 SHRED=shred&lt;br /&gt;
 SHRED_OPTS=--force --iterations=9 --zero --remove&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Storage Options&lt;br /&gt;
 # Only 1 option should be un-commented (the last one will be used).&lt;br /&gt;
 # Update CP_DEST paths as neccessary.&lt;br /&gt;
 #&lt;br /&gt;
 # CP - Storage on a local (or networked) machine. Could be Dropbox/Wuala folder.&lt;br /&gt;
 #CP=cp&lt;br /&gt;
 #CP_DEST=smb://machine/share/folder/  # /var/data/backups/, ~/Dropbox/, etc.&lt;br /&gt;
 #&lt;br /&gt;
 # SSH - Storage on a remote machine.&lt;br /&gt;
 CP=scp&lt;br /&gt;
 CP_DEST=&amp;quot;remoteuser@example.com:~/wallets/&amp;quot;&lt;br /&gt;
 #&lt;br /&gt;
 # S3 - Storage on Amazon&#039;s S3. Be sure s3cmd is installed and properly setup.&lt;br /&gt;
 # You may need &amp;quot;s3cmd put --force&amp;quot; if you use a sub-directory in CP_DEST.&lt;br /&gt;
 #CP=s3cmd put&lt;br /&gt;
 #CP_DEST=s3://bucket&lt;br /&gt;
 &lt;br /&gt;
 # Perform the backup.&lt;br /&gt;
 if&lt;br /&gt;
   echo -n Making backup...&lt;br /&gt;
   bitcoind backupwallet $WALLET&lt;br /&gt;
   test ! -s &amp;quot;$WALLET&amp;quot;&lt;br /&gt;
 then&lt;br /&gt;
   echo failed!&lt;br /&gt;
 elif&lt;br /&gt;
   echo done.&lt;br /&gt;
   echo -n Encrypting backup....&lt;br /&gt;
   ! gpg -r $USERNAME --output $WALLET_E --encrypt $WALLET&lt;br /&gt;
 then&lt;br /&gt;
   echo failed!&lt;br /&gt;
 elif&lt;br /&gt;
   echo done.&lt;br /&gt;
   echo -n Copying to backup location...&lt;br /&gt;
   ! $CP $WALLET_E $CP_DEST&lt;br /&gt;
 then&lt;br /&gt;
   echo failed!&lt;br /&gt;
 else&lt;br /&gt;
   echo done.&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 # Remove temporary wallets.&lt;br /&gt;
 if [ 1 -eq $USE_SHRED ]; then&lt;br /&gt;
   $SHRED $SHRED_OPTS $WALLET $WALLET_E&lt;br /&gt;
 else&lt;br /&gt;
   $RM $RM_OPTS $WALLET $WALLET_E&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
The shell script:&lt;br /&gt;
&lt;br /&gt;
* Calls bitcoind backupwallet to create a time/date-stamped wallet.&lt;br /&gt;
* GPG encrypts the wallet with your public key.&lt;br /&gt;
* Copies the result using one of several storage options (cp, scp, and s3cmd).&lt;br /&gt;
* Uses the rm or shred command to remove the temporary wallet files.&lt;br /&gt;
&lt;br /&gt;
Be sure to modify the script options to fit your setup. After you save, make sure the file can be executed properly by the cron user. Common permissions for files in /usr/local/bin/ can be applied using (verify with your distribution!):&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/bin/ &amp;amp;&amp;amp; chown root:root backupwallet.sh &amp;amp;&amp;amp; chmod 755 backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
&lt;br /&gt;
==Restore==&lt;br /&gt;
&lt;br /&gt;
Assuming your backup is recent enough that you haven&#039;t used up all of your key pool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:&lt;br /&gt;
* Quit bitcoin(d).&lt;br /&gt;
* Copy your backed up wallet.dat into your bitcoin profile directory.&lt;br /&gt;
* If copying into existing profile, delete file &#039;&#039;blkindex.dat&#039;&#039; and &#039;&#039;blk0001.dat&#039;&#039; to make the client re-scan the block chain.&lt;br /&gt;
And you&#039;ll be good as new.&lt;br /&gt;
&lt;br /&gt;
==Erasing Plain Text Wallets==&lt;br /&gt;
&lt;br /&gt;
A good practice is to keep at least two wallets, one as a &amp;quot;current account&amp;quot; for everyday transactions and one as a &amp;quot;savings account&amp;quot; where you store the majority of your Bitcoins.  &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;savings account&amp;quot; wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your &amp;quot;current account&amp;quot; wallet.&lt;br /&gt;
&lt;br /&gt;
In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will &#039;&#039;not&#039;&#039; generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.&lt;br /&gt;
&lt;br /&gt;
The Linux &#039;&#039;&#039;shred&#039;&#039;&#039; command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover.  Using shred (and similar tools on Windows) however does not guarantee that still other copies don&#039;t exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your  filesystem, duplicating your wallet.dat.&lt;br /&gt;
&lt;br /&gt;
In Mac OS, the equivalent of &#039;&#039;&#039;shred&#039;&#039;&#039; is &#039;&#039;&#039;srm&#039;&#039;&#039; (introduced in Leopard). Using the Finder to remove files, clicking &amp;quot;Secure Empty Trash&amp;quot; in the Finder menu will shred the contents of the trash can. As with any OS this doesn&#039;t guarantee that there are not other copies elsewhere on your system.&lt;br /&gt;
&lt;br /&gt;
For Windows, the built-in command &#039;&#039;cipher /W&#039;&#039; will shred all previously-deleted files. [http://www.cylog.org/utilities/cybershredder.jsp CyberShredder] can securely deleted individual files.&lt;br /&gt;
&lt;br /&gt;
==eWallet==&lt;br /&gt;
&lt;br /&gt;
Storing bitcoins with an [[eWallet]] provider incurs risks as well. Basically you grant the third party, in this case eWallet, full access to your wallet.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Data directory]]&lt;br /&gt;
* [http://startbitcoin.com/how-to-create-a-secure-bitcoin-wallet/ Secure Bitcoin Wallet Tutorial]&lt;br /&gt;
* [[How to set up a secure offline savings wallet]]&lt;br /&gt;
&lt;br /&gt;
[[de:Sichere deine Geldbörse]]&lt;br /&gt;
[[zh-cn:保护你的钱包]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12227</id>
		<title>Securing your wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12227"/>
		<updated>2011-07-02T00:19:12Z</updated>

		<summary type="html">&lt;p&gt;D-man97: /* Linux solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Wallet security can be broken down into two independent goals:&lt;br /&gt;
# Protecting your wallet against loss.&lt;br /&gt;
# Protecting your wallet against theft.&lt;br /&gt;
&lt;br /&gt;
In the case that your current wallet hasn&#039;t been protected adequately (e.g. put online with a weaker password):&lt;br /&gt;
# Making a new secure wallet, using appropriate long-term protection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For a brief overview see also: [[Wallet Security Dos and Don&#039;ts (Windows)|Wallet Security Dos and Don&#039;ts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Technical Background==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions send Bitcoins to a specific public key. A Bitcoin address is an encoded hash of a public key. In order to use received Bitcoins, you need to have the private key matching the public key you received with. This is sort of like a super long password associated with an account (public key). Your Bitcoin wallet contains all of the private keys necessary for spending your received transactions. If you delete your wallet without a backup, then you no longer have the authorization information necessary to claim your coins, and the coins associated with those keys are lost forever.&lt;br /&gt;
&lt;br /&gt;
The wallet contains a pool of queued keys. By default there are 100 keys in the [[key pool]].  The size of the pool is configurable using the &amp;quot;-keypool&amp;quot; command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.&lt;br /&gt;
&lt;br /&gt;
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.&lt;br /&gt;
&lt;br /&gt;
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient&#039;s public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.&lt;br /&gt;
&lt;br /&gt;
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.&lt;br /&gt;
&lt;br /&gt;
== Making a new wallet ==&lt;br /&gt;
&lt;br /&gt;
In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.&lt;br /&gt;
&lt;br /&gt;
For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised.  Just re-encrypting isn&#039;t secure.  One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).&lt;br /&gt;
&lt;br /&gt;
==Making a secure workspace==&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
The first step is to make a [http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/ new user,] so run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser new_user_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as root. When you get to the prompt &#039;Enter the new value, or press ENTER for the default&#039;, just keep hitting ENTER.&lt;br /&gt;
&lt;br /&gt;
Then switch user to the new user.  To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the &#039;System/Quit&#039; screen, or if there is no switch icon on your system you can log out and log back in as the new user.  Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.&lt;br /&gt;
&lt;br /&gt;
For secure browsing, open Firefox, and then go into the Edit menu and click Preferences.  Starting from the left, click on the General tab, and in the &#039;Startup/When Firefox starts&#039; pop up menu, choose &#039;Show a Blank Page&#039;.  Then click on the Content tab, and deselect &#039;Load images automatically&#039; and deselect &#039;Enable Javascript&#039;.  Then click on the Privacy tab, and in the &#039;History/Firefox will&#039; pop up menu, choose &#039;Never remember history&#039;.  Then click on the Security tab, and in the Passwords section, deselect &#039;Remember passwords for sites&#039; and deselect &#039;Use a master password&#039;.  Then click on the Advanced tab, then click on the Update tab, and then in the &#039;Automatically check for updates to&#039; section, deselect &#039;Add-ons&#039; and &#039;Search Engines&#039;.&lt;br /&gt;
&lt;br /&gt;
When javascript is disabled, the [http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.23/bitcoin-0.3.23-linux.tar.gz/download linux download page] will not download automatically, so you&#039;ll have to click on the &#039;direct link&#039; part of the &amp;quot;Problems with the download? Please use this &#039;direct link&#039; or try another mirror.&amp;quot; line.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve made your secure new user, to maintain security you should use it only for bitcoin.&lt;br /&gt;
&lt;br /&gt;
It&#039;s also a good idea to encrypt the Home directory of whatever user you run Bitcoin under using ecryptfs-utils. To do this:&lt;br /&gt;
# If the Home directory is not empty you should back it up first, by just copying the data to an external drive or something.&lt;br /&gt;
# install ecryptfs-utils (on Ubuntu: sudo apt-get install ecryptfs-utils)&lt;br /&gt;
# log out of X (graphical system) and press Ctrl+Alt+F1 to login to the command shell (you must be logged out or some files will be open and the tool won&#039;t be able to encrypt your data)&lt;br /&gt;
# change directory to something that&#039;s not in your home folder (ex: cd / )&lt;br /&gt;
# run the migration tool (on Ubuntu: sudo ecryptfs-migrate-home -u username)&lt;br /&gt;
# if it&#039;s successful, you can now press ALT+F8 to go back to the GUI and login&lt;br /&gt;
# run &#039;ecryptfs-unwrap-passphrase&#039; and &#039;&#039;&#039;WRITE DOWN OR SAVE THE CODE IT RETURNS&#039;&#039;&#039; because you will need it if you ever have to pull your data off while the OS is not working. (You can run it again later if you need to, but run it now so that you can get your data if your Linux install gets botched.)&lt;br /&gt;
# run &#039;ecryptfs-setup-swap&#039; to encrypt your swap partition (the encrypted folder data is not encrypted while it&#039;s in memory, and so if it&#039;s ever sent to the swap partition it can be stolen from there unless that too is encrypted - be aware that this will mean you cannot use Hibernate anymore, as the bootloader won&#039;t be able to restore the hibernation data)&lt;br /&gt;
(instructions from [http://bodhizazen.net/Tutorials/Ecryptfs/#Migrate])&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
=====Backup all data (500MB)=====&lt;br /&gt;
Follow these instructions to backup all the bitcoin data (wallet and block chains) to an encrypted disk image.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 500MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move everything from ~/Library/Application Support/Bitcoin/ to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin ~/Library/Application Support/Bitcoin&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
=====Backup just wallet.dat (40MB)=====&lt;br /&gt;
Follow these instructions to backup just the wallet.dat file. This results in a smaller disk image, but it&#039;s more complicated to do.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 40MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move your wallet.dat file to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin/wallet.dat ~/Library/Application Support/Bitcoin/wallet.dat&lt;br /&gt;
&lt;br /&gt;
[[File:MountWalletAndLauchnBitcoin_OSX_Automator.png|thumbnail|150px|Mount Wallet and launch Bitcoin]]&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you start the Bitcoin application without having the image mounted, the application will overwrite your symlink with a new wallet. If that happens, don&#039;t panic. Just delete the new wallet.dat, mount the image, and recreate the symlink like above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Automation&#039;&#039;&#039;: You can create a small application using [http://en.wikipedia.org/wiki/Automator_%28software%29 Automator] (included in OS X) to automatically mount the wallet and then launch Bitcoin App. See the Screenshot on how to do this.&lt;br /&gt;
&lt;br /&gt;
If one &#039;&#039;doesn&#039;t&#039;&#039; want to use encrypted Disk images, then a &#039;&#039;&#039;small shell script&#039;&#039;&#039; can be used instead that takes care of decrypting the wallet, launching bitcoin client, and encrypting it after the client exits. This script works on both OSX and Linux: [http://lorelei.kaverit.org/bitcoin.sh bitcoin-launch-script]&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
If you are using Windows XP or Windows 7, you can keep your wallet on an encrypted disk image created by third-party software, such as [http://www.truecrypt.org/ TrueCrypt] (open source) or [http://www.jetico.com/encryption-bestcrypt/ Jetico BestCrypt] (commercial).  You can probably do the same with Windows Vista or Windows 2000.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You should configure BitCoin in this manner only on computers where you use BitCoin, but do not use that computer to mine.  For example, this is a good configuration for a notebook or tablet computer.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have installed the Windows BitCoin client and run it at least once, the process is described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;To mount the BitCoin data directory on an encrypted drive&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol start=1 type=1&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the third-party disk image encryption program of your choice to create and mount an encrypted disk image of at least 100 MB in size.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Locate the BitCoin data directory, and copy the directory with all contents to the encrypted drive.&lt;br /&gt;
&amp;lt;p&amp;gt;For help finding this directory, see &amp;lt;b&amp;gt;[[Securing_your_wallet#Locating_BitCoin_s_data_directory|Locating BitCoin&#039;s Data Directory]]&amp;lt;/b&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a Windows shortcut that starts BitCoin with the &amp;lt;code&amp;gt;-datadir&amp;lt;/code&amp;gt; parameter and specifies the encrypted drive and directory.&lt;br /&gt;
&amp;lt;p&amp;gt;For example, if you installed Bitcoin in the default directory, mounted your BitCoin encrypted drive as &amp;lt;code&amp;gt;E:\&amp;lt;/code&amp;gt;, and stored your BitCoin data directory on it as &amp;lt;code&amp;gt;Bitcoin&amp;lt;/code&amp;gt;, you would type the following command as the shortcut Target:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;C:\Program Files\Bitcoin\bitcoin.exe -datadir=E:\Bitcoin&amp;lt;/code&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open BitCoin&#039;s settings and configure it &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; to start automatically when you start Windows.&lt;br /&gt;
&amp;lt;p&amp;gt;This is to allow you to mount the BitCoin encrypted disk image before starting BitCoin.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Shut down BitCoin, and then restart it from the new shortcut.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After doing this, any time you want to use BitCoin, you must first mount the BitCoin encrypted disk image using the same drive designation, and then run BitCoin from the shortcut that you created, so that it can find its data and your wallet. :-)&lt;br /&gt;
&lt;br /&gt;
== Locating BitCoin&#039;s data directory ==&lt;br /&gt;
&lt;br /&gt;
The [[data directory]] is the location where Bitcoin&#039;s data files are stored, including the wallet data file.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
Go to Start -&amp;gt; Run (or press WinKey+R) and run this:&lt;br /&gt;
&lt;br /&gt;
 explorer %APPDATA%\BitCoin&lt;br /&gt;
&lt;br /&gt;
BitCoin&#039;s data folder will open. For most users, this is the following locations:&lt;br /&gt;
&lt;br /&gt;
 C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)&lt;br /&gt;
 &lt;br /&gt;
 C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;AppData&amp;quot; and &amp;quot;Application data&amp;quot; are hidden by default.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/.bitcoin/&lt;br /&gt;
&lt;br /&gt;
You need to do a &amp;quot;ls -a&amp;quot; to see directories that start with a dot.&lt;br /&gt;
&lt;br /&gt;
If that&#039;s not it, you can do a search like this:&lt;br /&gt;
&lt;br /&gt;
 find / -name wallet.dat -print 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/Library/Application Support/Bitcoin/&lt;br /&gt;
&lt;br /&gt;
==Backup==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: I would strongly recommend against using Dropbox to back up your Bitcoin data due to [http://en.wikipedia.org/wiki/Dropbox_(service)#Criticism security concerns] such as:&lt;br /&gt;
# the fact that they store your encryption key (meaning that a disgruntled Dropbox employee or an attacker who gained access to the system could decrypt your Dropbox data and steal your Bitcoins)&lt;br /&gt;
# the fact that the Dropbox client only needs a password for the first login. After it authenticates once, the server assigns it a token which it uses to show that, at one time, its user knew the password rather than sending the actual password (meaning that if you ever use the Dropbox client on another PC, that PC&#039;s users can access your Dropbox - even if you change your password - and can steal your Bitcoins or get a virus that will steal your Bitcoins).&lt;br /&gt;
&lt;br /&gt;
For these reasons, I personally prefer to use Wuala, which does not store your encryption key and requires a password each time (the client can be set to remember your password, but the server will check each time to make sure that the client is sending the correct password). Like Dropbox, the basic, lowest-storage-space account with Wuala is free of charge, and coincidentally, Wuala [http://www.wuala.com/en/bitcoin is experimenting with allowing users to pay for &amp;quot;upgraded&amp;quot; plans using Bitcoin.]&lt;br /&gt;
&lt;br /&gt;
In fact, whether you use Dropbox as your backup or not, use what Steve Gibson calls &amp;quot;pre-Internet encryption&amp;quot; (which he actually [http://itknowledgeexchange.techtarget.com/security-corner/cloud-security-and-privacy-do-they-exist/ discussed in the context of Dropbox&#039;s security concerns]) and use some form of encryption on the files before you back them up, just in case someone other than yourself ever gains access to that backup. Make sure to pick a password that&#039;s memorable but secure.&lt;br /&gt;
&lt;br /&gt;
The only file you need to back up is &amp;quot;wallet.dat&amp;quot;. Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.&lt;br /&gt;
&lt;br /&gt;
You can use the [[api|backupwallet]] JSON-RPC command to back up without shutting down Bitcoin.&lt;br /&gt;
&lt;br /&gt;
=== General Solutions ===&lt;br /&gt;
&lt;br /&gt;
Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.&lt;br /&gt;
* [http://www.7-zip.org/ 7-zip] - Supports strongly-encrypted archives.&lt;br /&gt;
* [http://www.axantum.com/axcrypt/ AxCrypt]&lt;br /&gt;
* [http://lrzip.kolivas.org lrzip] - Compression software for Linux and OSX that supports very high grade password protected encryption&lt;br /&gt;
* [http://www.truecrypt.org/ TrueCrypt] - Volume-based on-the-fly encryption (for advanced users)&lt;br /&gt;
* [http://www.rarlab.com/ WinRar] - Commonly used archive software that supports verification records and encryption.&lt;br /&gt;
&lt;br /&gt;
There is also a list of [[OpenSourceEncryptionSoftware|open source encryption software.]]&lt;br /&gt;
&lt;br /&gt;
Decrypting and encrypting the wallet.dat every time you start or quit the Bitcoin client can be &#039;&#039;tedious&#039;&#039; (and outright error-prone). If you want to keep your wallet encrypted (except while you&#039;re actually running the Bitcoin client), it&#039;s better to relegate the automation to a [http://lorelei.kaverit.org/bitcoin.sh small shell script] that handles the en/decryption and starting up Bitcoin client for you (Linux and OSX). &lt;br /&gt;
&lt;br /&gt;
There is also a method to Print out and encrypt your Wallet.dat as a special barcode. See details here: [[WalletPaperbackup]]&lt;br /&gt;
&lt;br /&gt;
==== Password Strength ====&lt;br /&gt;
Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is &#039;&#039;&#039;at least&#039;&#039;&#039; 12 characters long.  You can also use a multi-word password. [http://www.baekdal.com/tips/password-security-usability The Usability of Passwords] &lt;br /&gt;
&lt;br /&gt;
However, simply using dictionary words is also insecure as it opens you up to a dictionary attack. If you use dictionary words, be sure to throw random symbols and numbers in the mix as well.&lt;br /&gt;
&lt;br /&gt;
A good way to create secure but easy-to-remember passwords is to pick a password (ex: d0g) and pad it with a good number of repeated characters afterward (such as 10 $ signs - so d0g becomes d0g$$$$$$$$$$) - this is just as cryptographically secure as a random password of equal length so long as the attacker does not know which symbol you are following your &amp;quot;word&amp;quot; with and how many times it is repeated. ([https://www.grc.com/haystack.htm source])&lt;br /&gt;
&lt;br /&gt;
If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.&lt;br /&gt;
&lt;br /&gt;
Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.&lt;br /&gt;
&lt;br /&gt;
===== Choosing Your Password =====&lt;br /&gt;
Make sure you pick at least one character in each group:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Lowercase: abcdefghijklmnopqrstuvwxyz&lt;br /&gt;
  Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;br /&gt;
  Number: 1234567890&lt;br /&gt;
  Symbol: `~!@#$%^&amp;amp;*()-_=+\|[{]};:&#039;&amp;quot;,&amp;lt;.&amp;gt;/? (space)&lt;br /&gt;
  &lt;br /&gt;
  09 char = insecure&lt;br /&gt;
  10 char = low security&lt;br /&gt;
  11 char = medium security&lt;br /&gt;
  12 char = good security (good enough for your wallet)&lt;br /&gt;
  13 char = v.good enough for anything.&lt;br /&gt;
&lt;br /&gt;
==== Storage of Archive ====&lt;br /&gt;
One of the most simple methods for storing a appropriately &#039;&#039;&#039;encrypted&#039;&#039;&#039; archive of your wallet.dat file is to send the archive as an email attachment to your own e-mail address.  Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely.  One can even obfuscate the name of the files within the archive, and name the archive something less inviting, such as: &#039;personal notes&#039; or &#039;car insurance&#039;.&lt;br /&gt;
&lt;br /&gt;
Another solution is to use a file storage service like [http://www.wuala.com/bitcoin Wuala] ( encrypted, [http://www.bitcoin.org/smf/index.php?topic=5817.0 instructions]), [http://www.dropbox.com Dropbox] and [http://en.wikipedia.org/wiki/Comparison_of_online_backup_services others], including the more secure [http://www.spideroak.com SpiderOak].&lt;br /&gt;
&lt;br /&gt;
=== Linux solution ===&lt;br /&gt;
&lt;br /&gt;
Linux users can setup backups using cron by telling it to run a backup script at set intervals of time. Run &#039;crontab -e&#039; and add this line near the bottom:&lt;br /&gt;
&lt;br /&gt;
 01 */1 * * * /usr/local/bin/backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
This cron line will run the /usr/local/bin/backupwallet.sh script at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won&#039;t run.&lt;br /&gt;
&lt;br /&gt;
Create backupwallet.sh:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # /usr/local/bin/backupwallet.sh&lt;br /&gt;
 #&lt;br /&gt;
 # Performs backup of bitcoin wallet.&lt;br /&gt;
 #&lt;br /&gt;
 # Written by: https://en.bitcoin.it/wiki/Securing_your_wallet&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Standard Options&lt;br /&gt;
 #&lt;br /&gt;
 TS=$(date &amp;quot;+%Y%m%d-%H%M&amp;quot;)&lt;br /&gt;
 WALLET=/tmp/wallet${TS}&lt;br /&gt;
 WALLET_E=/tmp/wallet${TS}.crypt&lt;br /&gt;
 USERNAME=username  # Update to your bitcoin Linux username.&lt;br /&gt;
 RM=rm&lt;br /&gt;
 RM_OPTS=--force&lt;br /&gt;
 USE_SHRED=0  # Flip to 1 to use `shred` instead of `rm`.&lt;br /&gt;
 SHRED=shred&lt;br /&gt;
 SHRED_OPTS=--force --iterations=9 --zero --remove&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Storage Options&lt;br /&gt;
 # Only 1 option should be un-commented (the last one will be used).&lt;br /&gt;
 # Update CP_DEST paths as neccessary.&lt;br /&gt;
 #&lt;br /&gt;
 # CP - Storage on a local (or networked) machine. Could be Dropbox/Wuala folder.&lt;br /&gt;
 #CP=cp&lt;br /&gt;
 #CP_DEST=smb://machine/share/folder/  # /var/data/backups/, ~/Dropbox/, etc.&lt;br /&gt;
 #&lt;br /&gt;
 # SSH - Storage on a remote machine.&lt;br /&gt;
 CP=scp&lt;br /&gt;
 CP_DEST=&amp;quot;remoteuser@example.com:~/wallets/&amp;quot;&lt;br /&gt;
 #&lt;br /&gt;
 # S3 - Storage on Amazon&#039;s S3. Be sure s3cmd is installed and properly setup.&lt;br /&gt;
 # You may need &amp;quot;s3cmd put --force&amp;quot; if you use a sub-directory in CP_DEST.&lt;br /&gt;
 #CP=s3cmd put&lt;br /&gt;
 #CP_DEST=s3://bucket&lt;br /&gt;
 &lt;br /&gt;
 # Perform the backup.&lt;br /&gt;
 if&lt;br /&gt;
   echo -n Making backup...&lt;br /&gt;
   bitcoind backupwallet $WALLET&lt;br /&gt;
   [[ ! -s &amp;quot;$WALLET&amp;quot; ]]&lt;br /&gt;
 then&lt;br /&gt;
   echo failed!&lt;br /&gt;
 elif&lt;br /&gt;
   echo done.&lt;br /&gt;
   echo -n Encrypting backup....&lt;br /&gt;
   ! gpg -r $USERNAME --output $WALLET_E --encrypt $WALLET&lt;br /&gt;
 then&lt;br /&gt;
   echo failed!&lt;br /&gt;
 elif&lt;br /&gt;
   echo done.&lt;br /&gt;
   echo -n Copying to backup location...&lt;br /&gt;
   ! $CP $WALLET_E $CP_DEST&lt;br /&gt;
 then&lt;br /&gt;
   echo failed!&lt;br /&gt;
 else&lt;br /&gt;
   echo done.&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 # Remove temporary wallets.&lt;br /&gt;
 if [ 1 -eq $USE_SHRED ]; then&lt;br /&gt;
   $SHRED $SHRED_OPTS $WALLET $WALLET_E&lt;br /&gt;
 else&lt;br /&gt;
   $RM $RM_OPTS $WALLET $WALLET_E&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
The shell script:&lt;br /&gt;
&lt;br /&gt;
* Calls bitcoind backupwallet to create a time/date-stamped wallet.&lt;br /&gt;
* GPG encrypts the wallet with your public key.&lt;br /&gt;
* Copies the result using one of several storage options (cp, scp, and s3cmd).&lt;br /&gt;
* Uses the rm or shred command to remove the temporary wallet files.&lt;br /&gt;
&lt;br /&gt;
Be sure to modify the script options to fit your setup. After you save, make sure the file can be executed properly by the cron user. Common permissions for files in /usr/local/bin/ can be applied using (verify with your distribution!):&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/bin/ &amp;amp;&amp;amp; chown root:root backupwallet.sh &amp;amp;&amp;amp; chmod 755 backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
&lt;br /&gt;
==Restore==&lt;br /&gt;
&lt;br /&gt;
Assuming your backup is recent enough that you haven&#039;t used up all of your key pool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:&lt;br /&gt;
* Quit bitcoin(d).&lt;br /&gt;
* Copy your backed up wallet.dat into your bitcoin profile directory.&lt;br /&gt;
* If copying into existing profile, delete file &#039;&#039;blkindex.dat&#039;&#039; and &#039;&#039;blk0001.dat&#039;&#039; to make the client re-scan the block chain.&lt;br /&gt;
And you&#039;ll be good as new.&lt;br /&gt;
&lt;br /&gt;
==Erasing Plain Text Wallets==&lt;br /&gt;
&lt;br /&gt;
A good practice is to keep at least two wallets, one as a &amp;quot;current account&amp;quot; for everyday transactions and one as a &amp;quot;savings account&amp;quot; where you store the majority of your Bitcoins.  &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;savings account&amp;quot; wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your &amp;quot;current account&amp;quot; wallet.&lt;br /&gt;
&lt;br /&gt;
In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will &#039;&#039;not&#039;&#039; generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.&lt;br /&gt;
&lt;br /&gt;
The Linux &#039;&#039;&#039;shred&#039;&#039;&#039; command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover.  Using shred (and similar tools on Windows) however does not guarantee that still other copies don&#039;t exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your  filesystem, duplicating your wallet.dat.&lt;br /&gt;
&lt;br /&gt;
In Mac OS, the equivalent of &#039;&#039;&#039;shred&#039;&#039;&#039; is &#039;&#039;&#039;srm&#039;&#039;&#039; (introduced in Leopard). Using the Finder to remove files, clicking &amp;quot;Secure Empty Trash&amp;quot; in the Finder menu will shred the contents of the trash can. As with any OS this doesn&#039;t guarantee that there are not other copies elsewhere on your system.&lt;br /&gt;
&lt;br /&gt;
For Windows, the built-in command &#039;&#039;cipher /W&#039;&#039; will shred all previously-deleted files. [http://www.cylog.org/utilities/cybershredder.jsp CyberShredder] can securely deleted individual files.&lt;br /&gt;
&lt;br /&gt;
==eWallet==&lt;br /&gt;
&lt;br /&gt;
Storing bitcoins with an [[eWallet]] provider incurs risks as well. Basically you grant the third party, in this case eWallet, full access to your wallet.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Data directory]]&lt;br /&gt;
* [http://startbitcoin.com/how-to-create-a-secure-bitcoin-wallet/ Secure Bitcoin Wallet Tutorial]&lt;br /&gt;
* [[How to set up a secure offline savings wallet]]&lt;br /&gt;
&lt;br /&gt;
[[de:Sichere deine Geldbörse]]&lt;br /&gt;
[[zh-cn:保护你的钱包]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12226</id>
		<title>Securing your wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12226"/>
		<updated>2011-07-02T00:13:59Z</updated>

		<summary type="html">&lt;p&gt;D-man97: /* Linux solution */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Wallet security can be broken down into two independent goals:&lt;br /&gt;
# Protecting your wallet against loss.&lt;br /&gt;
# Protecting your wallet against theft.&lt;br /&gt;
&lt;br /&gt;
In the case that your current wallet hasn&#039;t been protected adequately (e.g. put online with a weaker password):&lt;br /&gt;
# Making a new secure wallet, using appropriate long-term protection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For a brief overview see also: [[Wallet Security Dos and Don&#039;ts (Windows)|Wallet Security Dos and Don&#039;ts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Technical Background==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions send Bitcoins to a specific public key. A Bitcoin address is an encoded hash of a public key. In order to use received Bitcoins, you need to have the private key matching the public key you received with. This is sort of like a super long password associated with an account (public key). Your Bitcoin wallet contains all of the private keys necessary for spending your received transactions. If you delete your wallet without a backup, then you no longer have the authorization information necessary to claim your coins, and the coins associated with those keys are lost forever.&lt;br /&gt;
&lt;br /&gt;
The wallet contains a pool of queued keys. By default there are 100 keys in the [[key pool]].  The size of the pool is configurable using the &amp;quot;-keypool&amp;quot; command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.&lt;br /&gt;
&lt;br /&gt;
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.&lt;br /&gt;
&lt;br /&gt;
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient&#039;s public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.&lt;br /&gt;
&lt;br /&gt;
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.&lt;br /&gt;
&lt;br /&gt;
== Making a new wallet ==&lt;br /&gt;
&lt;br /&gt;
In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.&lt;br /&gt;
&lt;br /&gt;
For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised.  Just re-encrypting isn&#039;t secure.  One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).&lt;br /&gt;
&lt;br /&gt;
==Making a secure workspace==&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
The first step is to make a [http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/ new user,] so run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser new_user_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as root. When you get to the prompt &#039;Enter the new value, or press ENTER for the default&#039;, just keep hitting ENTER.&lt;br /&gt;
&lt;br /&gt;
Then switch user to the new user.  To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the &#039;System/Quit&#039; screen, or if there is no switch icon on your system you can log out and log back in as the new user.  Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.&lt;br /&gt;
&lt;br /&gt;
For secure browsing, open Firefox, and then go into the Edit menu and click Preferences.  Starting from the left, click on the General tab, and in the &#039;Startup/When Firefox starts&#039; pop up menu, choose &#039;Show a Blank Page&#039;.  Then click on the Content tab, and deselect &#039;Load images automatically&#039; and deselect &#039;Enable Javascript&#039;.  Then click on the Privacy tab, and in the &#039;History/Firefox will&#039; pop up menu, choose &#039;Never remember history&#039;.  Then click on the Security tab, and in the Passwords section, deselect &#039;Remember passwords for sites&#039; and deselect &#039;Use a master password&#039;.  Then click on the Advanced tab, then click on the Update tab, and then in the &#039;Automatically check for updates to&#039; section, deselect &#039;Add-ons&#039; and &#039;Search Engines&#039;.&lt;br /&gt;
&lt;br /&gt;
When javascript is disabled, the [http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.23/bitcoin-0.3.23-linux.tar.gz/download linux download page] will not download automatically, so you&#039;ll have to click on the &#039;direct link&#039; part of the &amp;quot;Problems with the download? Please use this &#039;direct link&#039; or try another mirror.&amp;quot; line.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve made your secure new user, to maintain security you should use it only for bitcoin.&lt;br /&gt;
&lt;br /&gt;
It&#039;s also a good idea to encrypt the Home directory of whatever user you run Bitcoin under using ecryptfs-utils. To do this:&lt;br /&gt;
# If the Home directory is not empty you should back it up first, by just copying the data to an external drive or something.&lt;br /&gt;
# install ecryptfs-utils (on Ubuntu: sudo apt-get install ecryptfs-utils)&lt;br /&gt;
# log out of X (graphical system) and press Ctrl+Alt+F1 to login to the command shell (you must be logged out or some files will be open and the tool won&#039;t be able to encrypt your data)&lt;br /&gt;
# change directory to something that&#039;s not in your home folder (ex: cd / )&lt;br /&gt;
# run the migration tool (on Ubuntu: sudo ecryptfs-migrate-home -u username)&lt;br /&gt;
# if it&#039;s successful, you can now press ALT+F8 to go back to the GUI and login&lt;br /&gt;
# run &#039;ecryptfs-unwrap-passphrase&#039; and &#039;&#039;&#039;WRITE DOWN OR SAVE THE CODE IT RETURNS&#039;&#039;&#039; because you will need it if you ever have to pull your data off while the OS is not working. (You can run it again later if you need to, but run it now so that you can get your data if your Linux install gets botched.)&lt;br /&gt;
# run &#039;ecryptfs-setup-swap&#039; to encrypt your swap partition (the encrypted folder data is not encrypted while it&#039;s in memory, and so if it&#039;s ever sent to the swap partition it can be stolen from there unless that too is encrypted - be aware that this will mean you cannot use Hibernate anymore, as the bootloader won&#039;t be able to restore the hibernation data)&lt;br /&gt;
(instructions from [http://bodhizazen.net/Tutorials/Ecryptfs/#Migrate])&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
=====Backup all data (500MB)=====&lt;br /&gt;
Follow these instructions to backup all the bitcoin data (wallet and block chains) to an encrypted disk image.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 500MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move everything from ~/Library/Application Support/Bitcoin/ to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin ~/Library/Application Support/Bitcoin&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
=====Backup just wallet.dat (40MB)=====&lt;br /&gt;
Follow these instructions to backup just the wallet.dat file. This results in a smaller disk image, but it&#039;s more complicated to do.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 40MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move your wallet.dat file to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin/wallet.dat ~/Library/Application Support/Bitcoin/wallet.dat&lt;br /&gt;
&lt;br /&gt;
[[File:MountWalletAndLauchnBitcoin_OSX_Automator.png|thumbnail|150px|Mount Wallet and launch Bitcoin]]&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you start the Bitcoin application without having the image mounted, the application will overwrite your symlink with a new wallet. If that happens, don&#039;t panic. Just delete the new wallet.dat, mount the image, and recreate the symlink like above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Automation&#039;&#039;&#039;: You can create a small application using [http://en.wikipedia.org/wiki/Automator_%28software%29 Automator] (included in OS X) to automatically mount the wallet and then launch Bitcoin App. See the Screenshot on how to do this.&lt;br /&gt;
&lt;br /&gt;
If one &#039;&#039;doesn&#039;t&#039;&#039; want to use encrypted Disk images, then a &#039;&#039;&#039;small shell script&#039;&#039;&#039; can be used instead that takes care of decrypting the wallet, launching bitcoin client, and encrypting it after the client exits. This script works on both OSX and Linux: [http://lorelei.kaverit.org/bitcoin.sh bitcoin-launch-script]&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
If you are using Windows XP or Windows 7, you can keep your wallet on an encrypted disk image created by third-party software, such as [http://www.truecrypt.org/ TrueCrypt] (open source) or [http://www.jetico.com/encryption-bestcrypt/ Jetico BestCrypt] (commercial).  You can probably do the same with Windows Vista or Windows 2000.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You should configure BitCoin in this manner only on computers where you use BitCoin, but do not use that computer to mine.  For example, this is a good configuration for a notebook or tablet computer.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have installed the Windows BitCoin client and run it at least once, the process is described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;To mount the BitCoin data directory on an encrypted drive&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol start=1 type=1&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the third-party disk image encryption program of your choice to create and mount an encrypted disk image of at least 100 MB in size.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Locate the BitCoin data directory, and copy the directory with all contents to the encrypted drive.&lt;br /&gt;
&amp;lt;p&amp;gt;For help finding this directory, see &amp;lt;b&amp;gt;[[Securing_your_wallet#Locating_BitCoin_s_data_directory|Locating BitCoin&#039;s Data Directory]]&amp;lt;/b&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a Windows shortcut that starts BitCoin with the &amp;lt;code&amp;gt;-datadir&amp;lt;/code&amp;gt; parameter and specifies the encrypted drive and directory.&lt;br /&gt;
&amp;lt;p&amp;gt;For example, if you installed Bitcoin in the default directory, mounted your BitCoin encrypted drive as &amp;lt;code&amp;gt;E:\&amp;lt;/code&amp;gt;, and stored your BitCoin data directory on it as &amp;lt;code&amp;gt;Bitcoin&amp;lt;/code&amp;gt;, you would type the following command as the shortcut Target:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;C:\Program Files\Bitcoin\bitcoin.exe -datadir=E:\Bitcoin&amp;lt;/code&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open BitCoin&#039;s settings and configure it &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; to start automatically when you start Windows.&lt;br /&gt;
&amp;lt;p&amp;gt;This is to allow you to mount the BitCoin encrypted disk image before starting BitCoin.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Shut down BitCoin, and then restart it from the new shortcut.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After doing this, any time you want to use BitCoin, you must first mount the BitCoin encrypted disk image using the same drive designation, and then run BitCoin from the shortcut that you created, so that it can find its data and your wallet. :-)&lt;br /&gt;
&lt;br /&gt;
== Locating BitCoin&#039;s data directory ==&lt;br /&gt;
&lt;br /&gt;
The [[data directory]] is the location where Bitcoin&#039;s data files are stored, including the wallet data file.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
Go to Start -&amp;gt; Run (or press WinKey+R) and run this:&lt;br /&gt;
&lt;br /&gt;
 explorer %APPDATA%\BitCoin&lt;br /&gt;
&lt;br /&gt;
BitCoin&#039;s data folder will open. For most users, this is the following locations:&lt;br /&gt;
&lt;br /&gt;
 C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)&lt;br /&gt;
 &lt;br /&gt;
 C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;AppData&amp;quot; and &amp;quot;Application data&amp;quot; are hidden by default.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/.bitcoin/&lt;br /&gt;
&lt;br /&gt;
You need to do a &amp;quot;ls -a&amp;quot; to see directories that start with a dot.&lt;br /&gt;
&lt;br /&gt;
If that&#039;s not it, you can do a search like this:&lt;br /&gt;
&lt;br /&gt;
 find / -name wallet.dat -print 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/Library/Application Support/Bitcoin/&lt;br /&gt;
&lt;br /&gt;
==Backup==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: I would strongly recommend against using Dropbox to back up your Bitcoin data due to [http://en.wikipedia.org/wiki/Dropbox_(service)#Criticism security concerns] such as:&lt;br /&gt;
# the fact that they store your encryption key (meaning that a disgruntled Dropbox employee or an attacker who gained access to the system could decrypt your Dropbox data and steal your Bitcoins)&lt;br /&gt;
# the fact that the Dropbox client only needs a password for the first login. After it authenticates once, the server assigns it a token which it uses to show that, at one time, its user knew the password rather than sending the actual password (meaning that if you ever use the Dropbox client on another PC, that PC&#039;s users can access your Dropbox - even if you change your password - and can steal your Bitcoins or get a virus that will steal your Bitcoins).&lt;br /&gt;
&lt;br /&gt;
For these reasons, I personally prefer to use Wuala, which does not store your encryption key and requires a password each time (the client can be set to remember your password, but the server will check each time to make sure that the client is sending the correct password). Like Dropbox, the basic, lowest-storage-space account with Wuala is free of charge, and coincidentally, Wuala [http://www.wuala.com/en/bitcoin is experimenting with allowing users to pay for &amp;quot;upgraded&amp;quot; plans using Bitcoin.]&lt;br /&gt;
&lt;br /&gt;
In fact, whether you use Dropbox as your backup or not, use what Steve Gibson calls &amp;quot;pre-Internet encryption&amp;quot; (which he actually [http://itknowledgeexchange.techtarget.com/security-corner/cloud-security-and-privacy-do-they-exist/ discussed in the context of Dropbox&#039;s security concerns]) and use some form of encryption on the files before you back them up, just in case someone other than yourself ever gains access to that backup. Make sure to pick a password that&#039;s memorable but secure.&lt;br /&gt;
&lt;br /&gt;
The only file you need to back up is &amp;quot;wallet.dat&amp;quot;. Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.&lt;br /&gt;
&lt;br /&gt;
You can use the [[api|backupwallet]] JSON-RPC command to back up without shutting down Bitcoin.&lt;br /&gt;
&lt;br /&gt;
=== General Solutions ===&lt;br /&gt;
&lt;br /&gt;
Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.&lt;br /&gt;
* [http://www.7-zip.org/ 7-zip] - Supports strongly-encrypted archives.&lt;br /&gt;
* [http://www.axantum.com/axcrypt/ AxCrypt]&lt;br /&gt;
* [http://lrzip.kolivas.org lrzip] - Compression software for Linux and OSX that supports very high grade password protected encryption&lt;br /&gt;
* [http://www.truecrypt.org/ TrueCrypt] - Volume-based on-the-fly encryption (for advanced users)&lt;br /&gt;
* [http://www.rarlab.com/ WinRar] - Commonly used archive software that supports verification records and encryption.&lt;br /&gt;
&lt;br /&gt;
There is also a list of [[OpenSourceEncryptionSoftware|open source encryption software.]]&lt;br /&gt;
&lt;br /&gt;
Decrypting and encrypting the wallet.dat every time you start or quit the Bitcoin client can be &#039;&#039;tedious&#039;&#039; (and outright error-prone). If you want to keep your wallet encrypted (except while you&#039;re actually running the Bitcoin client), it&#039;s better to relegate the automation to a [http://lorelei.kaverit.org/bitcoin.sh small shell script] that handles the en/decryption and starting up Bitcoin client for you (Linux and OSX). &lt;br /&gt;
&lt;br /&gt;
There is also a method to Print out and encrypt your Wallet.dat as a special barcode. See details here: [[WalletPaperbackup]]&lt;br /&gt;
&lt;br /&gt;
==== Password Strength ====&lt;br /&gt;
Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is &#039;&#039;&#039;at least&#039;&#039;&#039; 12 characters long.  You can also use a multi-word password. [http://www.baekdal.com/tips/password-security-usability The Usability of Passwords] &lt;br /&gt;
&lt;br /&gt;
However, simply using dictionary words is also insecure as it opens you up to a dictionary attack. If you use dictionary words, be sure to throw random symbols and numbers in the mix as well.&lt;br /&gt;
&lt;br /&gt;
A good way to create secure but easy-to-remember passwords is to pick a password (ex: d0g) and pad it with a good number of repeated characters afterward (such as 10 $ signs - so d0g becomes d0g$$$$$$$$$$) - this is just as cryptographically secure as a random password of equal length so long as the attacker does not know which symbol you are following your &amp;quot;word&amp;quot; with and how many times it is repeated. ([https://www.grc.com/haystack.htm source])&lt;br /&gt;
&lt;br /&gt;
If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.&lt;br /&gt;
&lt;br /&gt;
Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.&lt;br /&gt;
&lt;br /&gt;
===== Choosing Your Password =====&lt;br /&gt;
Make sure you pick at least one character in each group:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Lowercase: abcdefghijklmnopqrstuvwxyz&lt;br /&gt;
  Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;br /&gt;
  Number: 1234567890&lt;br /&gt;
  Symbol: `~!@#$%^&amp;amp;*()-_=+\|[{]};:&#039;&amp;quot;,&amp;lt;.&amp;gt;/? (space)&lt;br /&gt;
  &lt;br /&gt;
  09 char = insecure&lt;br /&gt;
  10 char = low security&lt;br /&gt;
  11 char = medium security&lt;br /&gt;
  12 char = good security (good enough for your wallet)&lt;br /&gt;
  13 char = v.good enough for anything.&lt;br /&gt;
&lt;br /&gt;
==== Storage of Archive ====&lt;br /&gt;
One of the most simple methods for storing a appropriately &#039;&#039;&#039;encrypted&#039;&#039;&#039; archive of your wallet.dat file is to send the archive as an email attachment to your own e-mail address.  Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely.  One can even obfuscate the name of the files within the archive, and name the archive something less inviting, such as: &#039;personal notes&#039; or &#039;car insurance&#039;.&lt;br /&gt;
&lt;br /&gt;
Another solution is to use a file storage service like [http://www.wuala.com/bitcoin Wuala] ( encrypted, [http://www.bitcoin.org/smf/index.php?topic=5817.0 instructions]), [http://www.dropbox.com Dropbox] and [http://en.wikipedia.org/wiki/Comparison_of_online_backup_services others], including the more secure [http://www.spideroak.com SpiderOak].&lt;br /&gt;
&lt;br /&gt;
=== Linux solution ===&lt;br /&gt;
&lt;br /&gt;
Linux users can setup backups using cron by telling it to run a backup script at set intervals of time. Run &#039;crontab -e&#039; and add this line near the bottom:&lt;br /&gt;
&lt;br /&gt;
 01 */1 * * * /usr/local/bin/backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
This cron line will run the /usr/local/bin/backupwallet.sh script at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won&#039;t run.&lt;br /&gt;
&lt;br /&gt;
Create backupwallet.sh:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # /usr/local/bin/backupwallet.sh&lt;br /&gt;
 #&lt;br /&gt;
 # Performs backup of bitcoin wallet.&lt;br /&gt;
 #&lt;br /&gt;
 # Written by: https://en.bitcoin.it/wiki/Securing_your_wallet&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Standard Options&lt;br /&gt;
 #&lt;br /&gt;
 TS=$(date &amp;quot;+%Y%m%d-%H%M&amp;quot;)&lt;br /&gt;
 WALLET=/tmp/wallet${TS}&lt;br /&gt;
 WALLET_E=/tmp/wallet${TS}.crypt&lt;br /&gt;
 USERNAME=username  # Update to your bitcoin Linux username.&lt;br /&gt;
 RM=rm&lt;br /&gt;
 RM_OPTS=--force&lt;br /&gt;
 USE_SHRED=0  # Flip to 1 to use `shred` instead of `rm`.&lt;br /&gt;
 SHRED=shred&lt;br /&gt;
 SHRED_OPTS=--force --iterations=9 --zero --remove&lt;br /&gt;
 &lt;br /&gt;
 #&lt;br /&gt;
 # Storage Options&lt;br /&gt;
 # Only 1 option should be un-commented (the last one will be used).&lt;br /&gt;
 # Update CP_DEST paths as neccessary.&lt;br /&gt;
 #&lt;br /&gt;
 # CP - Storage on a local (or networked) machine. Could be Dropbox/Wuala folder.&lt;br /&gt;
 #CP=cp&lt;br /&gt;
 #CP_DEST=smb://machine/share/folder/  # /var/data/backups/, ~/Dropbox/, etc.&lt;br /&gt;
 #&lt;br /&gt;
 # SSH - Storage on a remote machine.&lt;br /&gt;
 CP=scp&lt;br /&gt;
 CP_DEST=&amp;quot;remoteuser@example.com:~/wallets/&amp;quot;&lt;br /&gt;
 #&lt;br /&gt;
 # S3 - Storage on Amazon&#039;s S3. Be sure s3cmd is installed and properly setup.&lt;br /&gt;
 # You may need &amp;quot;s3cmd put --force&amp;quot; if you use a sub-directory in CP_DEST.&lt;br /&gt;
 #CP=s3cmd put&lt;br /&gt;
 #CP_DEST=s3://bucket&lt;br /&gt;
 &lt;br /&gt;
 # Perform the backup.&lt;br /&gt;
 if&lt;br /&gt;
   echo -n Making backup...&lt;br /&gt;
   bitcoind backupwallet $WALLET&lt;br /&gt;
   [[ ! -s &amp;quot;$WALLET&amp;quot; ]]&lt;br /&gt;
 then&lt;br /&gt;
   echo failed!&lt;br /&gt;
 elif&lt;br /&gt;
   echo done.&lt;br /&gt;
   echo -n Encrypting backup....&lt;br /&gt;
   ! gpg -r $USERNAME --output $WALLET_E --encrypt $WALLET&lt;br /&gt;
 then&lt;br /&gt;
   echo failed!&lt;br /&gt;
 elif&lt;br /&gt;
   echo done.&lt;br /&gt;
   echo -n Copying to backup location...&lt;br /&gt;
   ! $CP $WALLET_E $CP_DEST&lt;br /&gt;
 then&lt;br /&gt;
   echo failed!&lt;br /&gt;
 else&lt;br /&gt;
   echo done.&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 # Remove temporary wallets.&lt;br /&gt;
 if [ 1 -eq $USE_SHRED ]; then&lt;br /&gt;
   $SHRED $SHRED_OPTS $WALLET $WALLET_E&lt;br /&gt;
 else&lt;br /&gt;
   $RM $RM_OPTS $WALLET $WALLET_E&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
The shell script:&lt;br /&gt;
&lt;br /&gt;
* Calls bitcoind backupwallet to create a time/date-stamped wallet.&lt;br /&gt;
* GPG encrypts the wallet with your public key.&lt;br /&gt;
* Copies the result using one of several storage options (cp, scp, and s3cmd).&lt;br /&gt;
* Uses the rm or shred command to remove the temporary wallet files.&lt;br /&gt;
&lt;br /&gt;
Be sure to modify the script options to fit your setup. After you save, make sure the file can be executed properly by the cron user. Common permissions for /usr/local/bin can be applied using (verify with your distribution!):&lt;br /&gt;
&lt;br /&gt;
 cd /usr/local/bin/ &amp;amp;&amp;amp; chown root:root backupwallet.sh &amp;amp;&amp;amp; chmod 755 backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
&lt;br /&gt;
==Restore==&lt;br /&gt;
&lt;br /&gt;
Assuming your backup is recent enough that you haven&#039;t used up all of your key pool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:&lt;br /&gt;
* Quit bitcoin(d).&lt;br /&gt;
* Copy your backed up wallet.dat into your bitcoin profile directory.&lt;br /&gt;
* If copying into existing profile, delete file &#039;&#039;blkindex.dat&#039;&#039; and &#039;&#039;blk0001.dat&#039;&#039; to make the client re-scan the block chain.&lt;br /&gt;
And you&#039;ll be good as new.&lt;br /&gt;
&lt;br /&gt;
==Erasing Plain Text Wallets==&lt;br /&gt;
&lt;br /&gt;
A good practice is to keep at least two wallets, one as a &amp;quot;current account&amp;quot; for everyday transactions and one as a &amp;quot;savings account&amp;quot; where you store the majority of your Bitcoins.  &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;savings account&amp;quot; wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your &amp;quot;current account&amp;quot; wallet.&lt;br /&gt;
&lt;br /&gt;
In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will &#039;&#039;not&#039;&#039; generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.&lt;br /&gt;
&lt;br /&gt;
The Linux &#039;&#039;&#039;shred&#039;&#039;&#039; command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover.  Using shred (and similar tools on Windows) however does not guarantee that still other copies don&#039;t exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your  filesystem, duplicating your wallet.dat.&lt;br /&gt;
&lt;br /&gt;
In Mac OS, the equivalent of &#039;&#039;&#039;shred&#039;&#039;&#039; is &#039;&#039;&#039;srm&#039;&#039;&#039; (introduced in Leopard). Using the Finder to remove files, clicking &amp;quot;Secure Empty Trash&amp;quot; in the Finder menu will shred the contents of the trash can. As with any OS this doesn&#039;t guarantee that there are not other copies elsewhere on your system.&lt;br /&gt;
&lt;br /&gt;
For Windows, the built-in command &#039;&#039;cipher /W&#039;&#039; will shred all previously-deleted files. [http://www.cylog.org/utilities/cybershredder.jsp CyberShredder] can securely deleted individual files.&lt;br /&gt;
&lt;br /&gt;
==eWallet==&lt;br /&gt;
&lt;br /&gt;
Storing bitcoins with an [[eWallet]] provider incurs risks as well. Basically you grant the third party, in this case eWallet, full access to your wallet.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Data directory]]&lt;br /&gt;
* [http://startbitcoin.com/how-to-create-a-secure-bitcoin-wallet/ Secure Bitcoin Wallet Tutorial]&lt;br /&gt;
* [[How to set up a secure offline savings wallet]]&lt;br /&gt;
&lt;br /&gt;
[[de:Sichere deine Geldbörse]]&lt;br /&gt;
[[zh-cn:保护你的钱包]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12224</id>
		<title>Securing your wallet</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Securing_your_wallet&amp;diff=12224"/>
		<updated>2011-07-01T23:28:20Z</updated>

		<summary type="html">&lt;p&gt;D-man97: /* Choosing Your Password */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
Wallet security can be broken down into two independent goals:&lt;br /&gt;
# Protecting your wallet against loss.&lt;br /&gt;
# Protecting your wallet against theft.&lt;br /&gt;
&lt;br /&gt;
In the case that your current wallet hasn&#039;t been protected adequately (e.g. put online with a weaker password):&lt;br /&gt;
# Making a new secure wallet, using appropriate long-term protection.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;For a brief overview see also: [[Wallet Security Dos and Don&#039;ts (Windows)|Wallet Security Dos and Don&#039;ts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Technical Background==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions send Bitcoins to a specific public key. A Bitcoin address is an encoded hash of a public key. In order to use received Bitcoins, you need to have the private key matching the public key you received with. This is sort of like a super long password associated with an account (public key). Your Bitcoin wallet contains all of the private keys necessary for spending your received transactions. If you delete your wallet without a backup, then you no longer have the authorization information necessary to claim your coins, and the coins associated with those keys are lost forever.&lt;br /&gt;
&lt;br /&gt;
The wallet contains a pool of queued keys. By default there are 100 keys in the [[key pool]].  The size of the pool is configurable using the &amp;quot;-keypool&amp;quot; command line argument.  When you need an address for whatever reason (send, “new address”, generation, etc.), the key is not actually generated freshly, but taken from this pool. A brand new address is generated to fill the pool back to 100. So when a backup is first created, it has all of your old keys plus 100 unused keys. After sending a transaction, it has 99 unused keys. After a total of 100 new-key actions, you will start using keys that are not in your backup. Since the backup does not have the private keys necessary for authorizing spends of these coins, restoring from the old backup will cause you to lose Bitcoins.&lt;br /&gt;
&lt;br /&gt;
Creating a new address generates a new pair of public and private keys, which are added to your wallet. Each keypair is mostly random numbers, so they cannot be known prior to generation. If you backup your wallet and then create more than 100 new addresses, the keypair associated with the newest addresses will not be in the old wallet because the new keypairs are only known after creating them. Any coins received at these addresses will be lost if you restore from the backup.&lt;br /&gt;
&lt;br /&gt;
The situation is made somewhat more confusing because the receiving addresses shown in the UI are not the only keys in your wallet. Each Bitcoin generation is given a new public key, and, more importantly, each sent transaction also sends some number of Bitcoins back to yourself at a new key. When sending Bitcoins to anyone, you generate a new keypair for yourself and simultaneously send Bitcoins to your new public key and the actual recipient&#039;s public key. This is an anonymity feature – it makes tracking Bitcoin transactions much more difficult.&lt;br /&gt;
&lt;br /&gt;
So if you create a backup, do more than 100 things that cause a new key to be used, and then restore from the backup, some Bitcoins will be lost. Bitcoin has not deleted any keys (keys are never deleted) – it has created a new key that is not in your old backup and then sent Bitcoins to it.&lt;br /&gt;
&lt;br /&gt;
== Making a new wallet ==&lt;br /&gt;
&lt;br /&gt;
In the case that a wallet has been distributed, or stored, in a (real or potential) compromised state, it is wise to create a new wallet and transfer the full balance of Bitcoins to an address contained only in the newly created wallet.&lt;br /&gt;
&lt;br /&gt;
For example, this will be necessary if one created a wallet with a password of 12 characters, as suggested. However a few years have passed and the wallet is now more easily compromised.  Just re-encrypting isn&#039;t secure.  One needs to make a new wallet and make the old wallet worthless (spending the funds to the new wallet).&lt;br /&gt;
&lt;br /&gt;
==Making a secure workspace==&lt;br /&gt;
&lt;br /&gt;
===Linux===&lt;br /&gt;
&lt;br /&gt;
The first step is to make a [http://www.howtogeek.com/howto/ubuntu/add-a-user-on-ubuntu-server/ new user,] so run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;adduser new_user_name&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
as root. When you get to the prompt &#039;Enter the new value, or press ENTER for the default&#039;, just keep hitting ENTER.&lt;br /&gt;
&lt;br /&gt;
Then switch user to the new user.  To get to the new user you can use the switch user icon for your system, which on Ubuntu is in the &#039;System/Quit&#039; screen, or if there is no switch icon on your system you can log out and log back in as the new user.  Then click on a folder in the new user to display the file browser, then keep going up folders until you see the new user home directory, then right click to bring up the Properties dialog, then click on the Permissions tab, then in the Others section, set the folder access to None.&lt;br /&gt;
&lt;br /&gt;
For secure browsing, open Firefox, and then go into the Edit menu and click Preferences.  Starting from the left, click on the General tab, and in the &#039;Startup/When Firefox starts&#039; pop up menu, choose &#039;Show a Blank Page&#039;.  Then click on the Content tab, and deselect &#039;Load images automatically&#039; and deselect &#039;Enable Javascript&#039;.  Then click on the Privacy tab, and in the &#039;History/Firefox will&#039; pop up menu, choose &#039;Never remember history&#039;.  Then click on the Security tab, and in the Passwords section, deselect &#039;Remember passwords for sites&#039; and deselect &#039;Use a master password&#039;.  Then click on the Advanced tab, then click on the Update tab, and then in the &#039;Automatically check for updates to&#039; section, deselect &#039;Add-ons&#039; and &#039;Search Engines&#039;.&lt;br /&gt;
&lt;br /&gt;
When javascript is disabled, the [http://sourceforge.net/projects/bitcoin/files/Bitcoin/bitcoin-0.3.23/bitcoin-0.3.23-linux.tar.gz/download linux download page] will not download automatically, so you&#039;ll have to click on the &#039;direct link&#039; part of the &amp;quot;Problems with the download? Please use this &#039;direct link&#039; or try another mirror.&amp;quot; line.&lt;br /&gt;
&lt;br /&gt;
After you&#039;ve made your secure new user, to maintain security you should use it only for bitcoin.&lt;br /&gt;
&lt;br /&gt;
It&#039;s also a good idea to encrypt the Home directory of whatever user you run Bitcoin under using ecryptfs-utils. To do this:&lt;br /&gt;
# If the Home directory is not empty you should back it up first, by just copying the data to an external drive or something.&lt;br /&gt;
# install ecryptfs-utils (on Ubuntu: sudo apt-get install ecryptfs-utils)&lt;br /&gt;
# log out of X (graphical system) and press Ctrl+Alt+F1 to login to the command shell (you must be logged out or some files will be open and the tool won&#039;t be able to encrypt your data)&lt;br /&gt;
# change directory to something that&#039;s not in your home folder (ex: cd / )&lt;br /&gt;
# run the migration tool (on Ubuntu: sudo ecryptfs-migrate-home -u username)&lt;br /&gt;
# if it&#039;s successful, you can now press ALT+F8 to go back to the GUI and login&lt;br /&gt;
# run &#039;ecryptfs-unwrap-passphrase&#039; and &#039;&#039;&#039;WRITE DOWN OR SAVE THE CODE IT RETURNS&#039;&#039;&#039; because you will need it if you ever have to pull your data off while the OS is not working. (You can run it again later if you need to, but run it now so that you can get your data if your Linux install gets botched.)&lt;br /&gt;
# run &#039;ecryptfs-setup-swap&#039; to encrypt your swap partition (the encrypted folder data is not encrypted while it&#039;s in memory, and so if it&#039;s ever sent to the swap partition it can be stolen from there unless that too is encrypted - be aware that this will mean you cannot use Hibernate anymore, as the bootloader won&#039;t be able to restore the hibernation data)&lt;br /&gt;
(instructions from [http://bodhizazen.net/Tutorials/Ecryptfs/#Migrate])&lt;br /&gt;
&lt;br /&gt;
===Mac===&lt;br /&gt;
&lt;br /&gt;
=====Backup all data (500MB)=====&lt;br /&gt;
Follow these instructions to backup all the bitcoin data (wallet and block chains) to an encrypted disk image.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 500MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move everything from ~/Library/Application Support/Bitcoin/ to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin ~/Library/Application Support/Bitcoin&lt;br /&gt;
&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
=====Backup just wallet.dat (40MB)=====&lt;br /&gt;
Follow these instructions to backup just the wallet.dat file. This results in a smaller disk image, but it&#039;s more complicated to do.&lt;br /&gt;
# Open Disk Utility&lt;br /&gt;
# Click New Image and choose 40MB, 128-bit or 256-bit (faster or more secure) encryption and single partition.&lt;br /&gt;
# Save it somewhere you won&#039;t lose it (like your Wuala, Dropbox, Strongspace or whatever)&lt;br /&gt;
# Choose a safe and strong password&lt;br /&gt;
# Move your wallet.dat file to the image&lt;br /&gt;
# Symlink it back so the app would be able to use it&lt;br /&gt;
:::ln -s /Volumes/Bitcoin/wallet.dat ~/Library/Application Support/Bitcoin/wallet.dat&lt;br /&gt;
&lt;br /&gt;
[[File:MountWalletAndLauchnBitcoin_OSX_Automator.png|thumbnail|150px|Mount Wallet and launch Bitcoin]]&lt;br /&gt;
Don&#039;t forget to mount your image before using Bitcoin and unmount after quitting it.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: If you start the Bitcoin application without having the image mounted, the application will overwrite your symlink with a new wallet. If that happens, don&#039;t panic. Just delete the new wallet.dat, mount the image, and recreate the symlink like above.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Automation&#039;&#039;&#039;: You can create a small application using [http://en.wikipedia.org/wiki/Automator_%28software%29 Automator] (included in OS X) to automatically mount the wallet and then launch Bitcoin App. See the Screenshot on how to do this.&lt;br /&gt;
&lt;br /&gt;
If one &#039;&#039;doesn&#039;t&#039;&#039; want to use encrypted Disk images, then a &#039;&#039;&#039;small shell script&#039;&#039;&#039; can be used instead that takes care of decrypting the wallet, launching bitcoin client, and encrypting it after the client exits. This script works on both OSX and Linux: [http://lorelei.kaverit.org/bitcoin.sh bitcoin-launch-script]&lt;br /&gt;
&lt;br /&gt;
===Windows===&lt;br /&gt;
&lt;br /&gt;
If you are using Windows XP or Windows 7, you can keep your wallet on an encrypted disk image created by third-party software, such as [http://www.truecrypt.org/ TrueCrypt] (open source) or [http://www.jetico.com/encryption-bestcrypt/ Jetico BestCrypt] (commercial).  You can probably do the same with Windows Vista or Windows 2000.  &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;NOTE:&#039;&#039;&#039; You should configure BitCoin in this manner only on computers where you use BitCoin, but do not use that computer to mine.  For example, this is a good configuration for a notebook or tablet computer.&lt;br /&gt;
&lt;br /&gt;
Assuming that you have installed the Windows BitCoin client and run it at least once, the process is described below.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;&amp;lt;b&amp;gt;To mount the BitCoin data directory on an encrypted drive&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol start=1 type=1&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Use the third-party disk image encryption program of your choice to create and mount an encrypted disk image of at least 100 MB in size.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Locate the BitCoin data directory, and copy the directory with all contents to the encrypted drive.&lt;br /&gt;
&amp;lt;p&amp;gt;For help finding this directory, see &amp;lt;b&amp;gt;[[Securing_your_wallet#Locating_BitCoin_s_data_directory|Locating BitCoin&#039;s Data Directory]]&amp;lt;/b&amp;gt;.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Create a Windows shortcut that starts BitCoin with the &amp;lt;code&amp;gt;-datadir&amp;lt;/code&amp;gt; parameter and specifies the encrypted drive and directory.&lt;br /&gt;
&amp;lt;p&amp;gt;For example, if you installed Bitcoin in the default directory, mounted your BitCoin encrypted drive as &amp;lt;code&amp;gt;E:\&amp;lt;/code&amp;gt;, and stored your BitCoin data directory on it as &amp;lt;code&amp;gt;Bitcoin&amp;lt;/code&amp;gt;, you would type the following command as the shortcut Target:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&amp;lt;code&amp;gt;C:\Program Files\Bitcoin\bitcoin.exe -datadir=E:\Bitcoin&amp;lt;/code&amp;gt;&amp;lt;/blockquote&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Open BitCoin&#039;s settings and configure it &amp;lt;b&amp;gt;NOT&amp;lt;/b&amp;gt; to start automatically when you start Windows.&lt;br /&gt;
&amp;lt;p&amp;gt;This is to allow you to mount the BitCoin encrypted disk image before starting BitCoin.&amp;lt;/p&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Shut down BitCoin, and then restart it from the new shortcut.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After doing this, any time you want to use BitCoin, you must first mount the BitCoin encrypted disk image using the same drive designation, and then run BitCoin from the shortcut that you created, so that it can find its data and your wallet. :-)&lt;br /&gt;
&lt;br /&gt;
== Locating BitCoin&#039;s data directory ==&lt;br /&gt;
&lt;br /&gt;
The [[data directory]] is the location where Bitcoin&#039;s data files are stored, including the wallet data file.&lt;br /&gt;
&lt;br /&gt;
=== Windows ===&lt;br /&gt;
&lt;br /&gt;
Go to Start -&amp;gt; Run (or press WinKey+R) and run this:&lt;br /&gt;
&lt;br /&gt;
 explorer %APPDATA%\BitCoin&lt;br /&gt;
&lt;br /&gt;
BitCoin&#039;s data folder will open. For most users, this is the following locations:&lt;br /&gt;
&lt;br /&gt;
 C:\Documents and Settings\YourUserName\Application data\BitCoin (XP)&lt;br /&gt;
 &lt;br /&gt;
 C:\Users\YourUserName\Appdata\Roaming\BitCoin (Vista and 7)&lt;br /&gt;
&lt;br /&gt;
&amp;quot;AppData&amp;quot; and &amp;quot;Application data&amp;quot; are hidden by default.&lt;br /&gt;
&lt;br /&gt;
=== Linux ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/.bitcoin/&lt;br /&gt;
&lt;br /&gt;
You need to do a &amp;quot;ls -a&amp;quot; to see directories that start with a dot.&lt;br /&gt;
&lt;br /&gt;
If that&#039;s not it, you can do a search like this:&lt;br /&gt;
&lt;br /&gt;
 find / -name wallet.dat -print 2&amp;gt;/dev/null&lt;br /&gt;
&lt;br /&gt;
=== Mac ===&lt;br /&gt;
&lt;br /&gt;
By default BitCoin will put its data here:&lt;br /&gt;
&lt;br /&gt;
 ~/Library/Application Support/Bitcoin/&lt;br /&gt;
&lt;br /&gt;
==Backup==&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note&#039;&#039;&#039;: I would strongly recommend against using Dropbox to back up your Bitcoin data due to [http://en.wikipedia.org/wiki/Dropbox_(service)#Criticism security concerns] such as:&lt;br /&gt;
# the fact that they store your encryption key (meaning that a disgruntled Dropbox employee or an attacker who gained access to the system could decrypt your Dropbox data and steal your Bitcoins)&lt;br /&gt;
# the fact that the Dropbox client only needs a password for the first login. After it authenticates once, the server assigns it a token which it uses to show that, at one time, its user knew the password rather than sending the actual password (meaning that if you ever use the Dropbox client on another PC, that PC&#039;s users can access your Dropbox - even if you change your password - and can steal your Bitcoins or get a virus that will steal your Bitcoins).&lt;br /&gt;
&lt;br /&gt;
For these reasons, I personally prefer to use Wuala, which does not store your encryption key and requires a password each time (the client can be set to remember your password, but the server will check each time to make sure that the client is sending the correct password). Like Dropbox, the basic, lowest-storage-space account with Wuala is free of charge, and coincidentally, Wuala [http://www.wuala.com/en/bitcoin is experimenting with allowing users to pay for &amp;quot;upgraded&amp;quot; plans using Bitcoin.]&lt;br /&gt;
&lt;br /&gt;
In fact, whether you use Dropbox as your backup or not, use what Steve Gibson calls &amp;quot;pre-Internet encryption&amp;quot; (which he actually [http://itknowledgeexchange.techtarget.com/security-corner/cloud-security-and-privacy-do-they-exist/ discussed in the context of Dropbox&#039;s security concerns]) and use some form of encryption on the files before you back them up, just in case someone other than yourself ever gains access to that backup. Make sure to pick a password that&#039;s memorable but secure.&lt;br /&gt;
&lt;br /&gt;
The only file you need to back up is &amp;quot;wallet.dat&amp;quot;. Ensure that BitCoin is closed, copy this file somewhere else, encrypt it, and put it somewhere safe. Ideally, you would put this file in two places: one nearby, and one 100+ miles away.&lt;br /&gt;
&lt;br /&gt;
You can use the [[api|backupwallet]] JSON-RPC command to back up without shutting down Bitcoin.&lt;br /&gt;
&lt;br /&gt;
=== General Solutions ===&lt;br /&gt;
&lt;br /&gt;
Your wallet.dat file is not encrypted by BitCoin. Anyone who can access it can easily steal all of your coins. Use one of these encryption programs if there is any chance someone might stumble upon your wallet.&lt;br /&gt;
* [http://www.7-zip.org/ 7-zip] - Supports strongly-encrypted archives.&lt;br /&gt;
* [http://www.axantum.com/axcrypt/ AxCrypt]&lt;br /&gt;
* [http://lrzip.kolivas.org lrzip] - Compression software for Linux and OSX that supports very high grade password protected encryption&lt;br /&gt;
* [http://www.truecrypt.org/ TrueCrypt] - Volume-based on-the-fly encryption (for advanced users)&lt;br /&gt;
* [http://www.rarlab.com/ WinRar] - Commonly used archive software that supports verification records and encryption.&lt;br /&gt;
&lt;br /&gt;
There is also a list of [[OpenSourceEncryptionSoftware|open source encryption software.]]&lt;br /&gt;
&lt;br /&gt;
Decrypting and encrypting the wallet.dat every time you start or quit the Bitcoin client can be &#039;&#039;tedious&#039;&#039; (and outright error-prone). If you want to keep your wallet encrypted (except while you&#039;re actually running the Bitcoin client), it&#039;s better to relegate the automation to a [http://lorelei.kaverit.org/bitcoin.sh small shell script] that handles the en/decryption and starting up Bitcoin client for you (Linux and OSX). &lt;br /&gt;
&lt;br /&gt;
There is also a method to Print out and encrypt your Wallet.dat as a special barcode. See details here: [[WalletPaperbackup]]&lt;br /&gt;
&lt;br /&gt;
==== Password Strength ====&lt;br /&gt;
Brute-force password cracking has come a long distance, a previously thought secure password of random [a-Z] [0-9] [!-~] of 8 characters long can be trivially solved now (using appropriate hardware)... The recommended length is &#039;&#039;&#039;at least&#039;&#039;&#039; 12 characters long.  You can also use a multi-word password. [http://www.baekdal.com/tips/password-security-usability The Usability of Passwords] &lt;br /&gt;
&lt;br /&gt;
However, simply using dictionary words is also insecure as it opens you up to a dictionary attack. If you use dictionary words, be sure to throw random symbols and numbers in the mix as well.&lt;br /&gt;
&lt;br /&gt;
A good way to create secure but easy-to-remember passwords is to pick a password (ex: d0g) and pad it with a good number of repeated characters afterward (such as 10 $ signs - so d0g becomes d0g$$$$$$$$$$) - this is just as cryptographically secure as a random password of equal length so long as the attacker does not know which symbol you are following your &amp;quot;word&amp;quot; with and how many times it is repeated. ([https://www.grc.com/haystack.htm source])&lt;br /&gt;
&lt;br /&gt;
If you use keyfiles in addition to a password, it is unlikely that your encrypted file can ever be cracked using brute force methods, even 10 years from now when even a 12 character password might be too short.&lt;br /&gt;
&lt;br /&gt;
Assume that any encrypted files you store online (eg. gmail, Dropbox) will be stored somewhere forever and can never be erased.&lt;br /&gt;
&lt;br /&gt;
===== Choosing Your Password =====&lt;br /&gt;
Make sure you pick at least one character in each group:&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
  Lowercase: abcdefghijklmnopqrstuvwxyz&lt;br /&gt;
  Uppercase: ABCDEFGHIJKLMNOPQRSTUVWXYZ&lt;br /&gt;
  Number: 1234567890&lt;br /&gt;
  Symbol: `~!@#$%^&amp;amp;*()-_=+\|[{]};:&#039;&amp;quot;,&amp;lt;.&amp;gt;/? (space)&lt;br /&gt;
  &lt;br /&gt;
  09 char = insecure&lt;br /&gt;
  10 char = low security&lt;br /&gt;
  11 char = medium security&lt;br /&gt;
  12 char = good security (good enough for your wallet)&lt;br /&gt;
  13 char = v.good enough for anything.&lt;br /&gt;
&lt;br /&gt;
==== Storage of Archive ====&lt;br /&gt;
One of the most simple methods for storing a appropriately &#039;&#039;&#039;encrypted&#039;&#039;&#039; archive of your wallet.dat file is to send the archive as an email attachment to your own e-mail address.  Services like gmail.com use very comprehensive distributed networks that make the loss of data very unlikely.  One can even obfuscate the name of the files within the archive, and name the archive something less inviting, such as: &#039;personal notes&#039; or &#039;car insurance&#039;.&lt;br /&gt;
&lt;br /&gt;
Another solution is to use a file storage service like [http://www.wuala.com/bitcoin Wuala] ( encrypted, [http://www.bitcoin.org/smf/index.php?topic=5817.0 instructions]), [http://www.dropbox.com Dropbox] and [http://en.wikipedia.org/wiki/Comparison_of_online_backup_services others], including the more secure [http://www.spideroak.com SpiderOak].&lt;br /&gt;
&lt;br /&gt;
=== Linux solution ===&lt;br /&gt;
&lt;br /&gt;
Linux users can setup cron by running &#039;crontab -e&#039; and adding this line:&lt;br /&gt;
&lt;br /&gt;
  01 */1 * * * /usr/local/bin/backupwallet.sh&lt;br /&gt;
&lt;br /&gt;
This cron line runs backupwallet.sh at the 01 minute of every hour. Remember to add a newline after the last line of the crontab file, or else the last line won&#039;t run.&lt;br /&gt;
&lt;br /&gt;
backupwallet.sh:&lt;br /&gt;
&lt;br /&gt;
  #!/bin/bash&lt;br /&gt;
  &lt;br /&gt;
  TS=$(date &amp;quot;+%Y%m%d-%H-%M&amp;quot;)&lt;br /&gt;
  WALLET=/tmp/wallet${TS}&lt;br /&gt;
  WALLET_E=/tmp/wallet${TS}.crypt&lt;br /&gt;
  &lt;br /&gt;
  if&lt;br /&gt;
    echo -n making backup...&lt;br /&gt;
    bitcoind backupwallet $WALLET &lt;br /&gt;
    &amp;lt;nowiki&amp;gt;[[ ! -s &amp;quot;$WALLET&amp;quot; ]]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  then echo failed&lt;br /&gt;
  elif&lt;br /&gt;
    echo done&lt;br /&gt;
    echo -n encrypting....&lt;br /&gt;
    ! gpg -r myusername --output $WALLET_E --encrypt $WALLET&lt;br /&gt;
  then echo failed&lt;br /&gt;
  elif&lt;br /&gt;
    echo done&lt;br /&gt;
    echo -n copying to distant server...&lt;br /&gt;
    ! scp $WALLET_E user@myserver.org:~/wallets/&lt;br /&gt;
  then echo failed&lt;br /&gt;
  else echo done&lt;br /&gt;
  fi&lt;br /&gt;
  &lt;br /&gt;
  rm -f $WALLET $WALLET_E&lt;br /&gt;
&lt;br /&gt;
The shell script:&lt;br /&gt;
&lt;br /&gt;
* Calls bitcoind backupwallet to create a time/date-stamped wallet.&lt;br /&gt;
* GPG encrypts the wallet with your public key.&lt;br /&gt;
* Copies the result to a backup location.&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
&lt;br /&gt;
==Restore==&lt;br /&gt;
&lt;br /&gt;
Assuming your backup is recent enough that you haven&#039;t used up all of your key pool... restoring a wallet to a new (or old) location and rescanning the block chain should leave you with all your coins. Just follow these steps:&lt;br /&gt;
* Quit bitcoin(d).&lt;br /&gt;
* Copy your backed up wallet.dat into your bitcoin profile directory.&lt;br /&gt;
* If copying into existing profile, delete file &#039;&#039;blkindex.dat&#039;&#039; and &#039;&#039;blk0001.dat&#039;&#039; to make the client re-scan the block chain.&lt;br /&gt;
And you&#039;ll be good as new.&lt;br /&gt;
&lt;br /&gt;
==Erasing Plain Text Wallets==&lt;br /&gt;
&lt;br /&gt;
A good practice is to keep at least two wallets, one as a &amp;quot;current account&amp;quot; for everyday transactions and one as a &amp;quot;savings account&amp;quot; where you store the majority of your Bitcoins.  &lt;br /&gt;
&lt;br /&gt;
The &amp;quot;savings account&amp;quot; wallet should be backed up in encrypted form only and all plaintext copies of this wallet should be erased. In case someone gains unauthorised access to your computer (either by physically stealing it or by exploiting a system vulnerability via the internet), they will only be able to spend the coins in your &amp;quot;current account&amp;quot; wallet.&lt;br /&gt;
&lt;br /&gt;
In most operating systems, including Windows, Linux, and Mac OS X, simply deleting a wallet.dat file will &#039;&#039;not&#039;&#039; generally destroy it. It is likely that advanced tools can still be used to recover the wallet.dat file, even after it has been deleted.&lt;br /&gt;
&lt;br /&gt;
The Linux &#039;&#039;&#039;shred&#039;&#039;&#039; command can be used to overwrite the wallet file with random data prior to deleting; this particular copy of the file will then be practically impossible to recover.  Using shred (and similar tools on Windows) however does not guarantee that still other copies don&#039;t exist somewhere hidden on your HD. That will depend on your system configuration and what packages you have installed. Some system restore and backup tools, for instance, create periodic snapshots of your  filesystem, duplicating your wallet.dat.&lt;br /&gt;
&lt;br /&gt;
In Mac OS, the equivalent of &#039;&#039;&#039;shred&#039;&#039;&#039; is &#039;&#039;&#039;srm&#039;&#039;&#039; (introduced in Leopard). Using the Finder to remove files, clicking &amp;quot;Secure Empty Trash&amp;quot; in the Finder menu will shred the contents of the trash can. As with any OS this doesn&#039;t guarantee that there are not other copies elsewhere on your system.&lt;br /&gt;
&lt;br /&gt;
For Windows, the built-in command &#039;&#039;cipher /W&#039;&#039; will shred all previously-deleted files. [http://www.cylog.org/utilities/cybershredder.jsp CyberShredder] can securely deleted individual files.&lt;br /&gt;
&lt;br /&gt;
==eWallet==&lt;br /&gt;
&lt;br /&gt;
Storing bitcoins with an [[eWallet]] provider incurs risks as well. Basically you grant the third party, in this case eWallet, full access to your wallet.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Data directory]]&lt;br /&gt;
* [http://startbitcoin.com/how-to-create-a-secure-bitcoin-wallet/ Secure Bitcoin Wallet Tutorial]&lt;br /&gt;
* [[How to set up a secure offline savings wallet]]&lt;br /&gt;
&lt;br /&gt;
[[de:Sichere deine Geldbörse]]&lt;br /&gt;
[[zh-cn:保护你的钱包]]&lt;/div&gt;</summary>
		<author><name>D-man97</name></author>
	</entry>
</feed>