ubuntu文件夹加密_安装Ubuntu后如何加密您的主文件夹

ubuntu文件夹加密

ubuntu文件夹加密

image

Ubuntu offers to encrypt your home folder during installation. If you decline the encryption and change your mind later, you don’t have to reinstall Ubuntu. You can activate the encryption with a few terminal commands.

Ubuntu提供了在安装过程中加密您的主文件夹的功能。 如果您拒绝加密并稍后改变主意,则不必重新安装Ubuntu。 您可以使用一些终端命令来激活加密。

Ubuntu uses eCryptfs for encryption. When you log in, your home directory is automatically decrypted with your password. While there is a performance penalty to encryption, it can keep private data confidential, particularly on laptops that may be stolen.

Ubuntu使用eCryptfs进行加密。 登录时,主目录会自动用密码解密。 虽然加密会降低性能,但它可以使私人数据保密,尤其是在可能被盗的笔记本电脑上。

入门 (Getting Started)

Before doing any of this, you should ensure you have a backup of your home directory and important files. The migration command will create a backup on your computer, but it’s important to have an additional backup – just in case.

在执行任何此操作之前,您应确保已备份主目录和重要文件。 迁移命令将在您的计算机上创建一个备份,但是以防万一,有一个额外的备份很重要。

First, install the encryption utilities:

首先,安装加密实用程序:

sudo apt-get install ecryptfs-utils cryptsetup

sudo apt-get install ecryptfs-utils cryptsetup

image

You’ll have to encrypt your home directory while you’re not logged in. This means that you’ll need another user account with administrator (sudo) privileges – you can create one from Ubuntu’s User Accounts window. To open it, click your name on the panel and select User Accounts.

您必须在未登录时加密主目录。这意味着您将需要另一个具有管理员(sudo)特权的用户帐户-您可以从Ubuntu的“用户帐户”窗口中创建一个。 要打开它,请在面板上单击您的名称,然后选择“用户帐户”。

image

Create a new user account and make it an administrator.

创建一个新的用户帐户并使其成为管理员。

image

Set a password by clicking the password box. The account is disabled until you apply a password.

通过单击密码框来设置密码。 该帐户将被禁用,直到您应用密码。

image

After creating the user account, log out of your desktop.

创建用户帐户后,注销桌面。

image

迁移主文件夹 (Migrating Your Home Folder)

Select your new, temporary user account on the login screen and log in with it.

在登录屏幕上选择新的临时用户帐户,然后使用它登录。

image

Run the following command to encrypt your home directory, replacing user with the name of your user account:

运行以下命令来加密您的主目录,将user替换为您的用户帐户名称:

sudo ecryptfs-migrate-home -u user

sudo ecryptfs-migrate-home -u用户

You’ll have to provide your user account’s password. After you do, your home directory will be encrypted and you’ll be presented with some important notes. In summary, the notes say:

您必须提供用户帐户的密码。 完成后,您的主目录将被加密,并且将向您显示一些重要的注释。 总而言之,注释说明:

  1. You must log in as the other user account immediately – before a reboot!

    在重新启动之前,您必须立即以其他用户帐户登录!
  2. A copy of your original home directory was made. You can restore the backup directory if you lose access to your files.

    已复制原始主目录。 如果您无法访问文件,则可以还原备份目录。
  3. You should generate and record a recovery phrase.

    您应该生成并记录一个恢复短语。
  4. You should encrypt your swap partition, too.

    您也应该加密交换分区。
image

Log out and log back in as your original user account. Do not reboot your system before logging back in!

注销并以原始用户帐户重新登录。 重新登录之前,请勿重新引导系统!

image

After you log in, click the Run this action now button to create a recovery passphrase. Keep this passphrase somewhere safe – you’ll need it if you have to manually recover your files in the future.

登录后,单击立即运行此按钮创建恢复密码。 将此密码短语保存在安全的地方–如果以后必须手动恢复文件,则将需要它。

image

You can run the ecryptfs-unwrap-passphrase command to view this passphrase at any time.

您可以随时运行ecryptfs-unwrap-passphrase命令以查看此密码短语。

加密交换分区 (Encrypting the Swap Partition)

When you set up an encrypted home directory while installing Ubuntu, your swap partition is also encrypted. After setting up home directory encryption, you’ll also want to set up swap encryption. To do so, run the following command in a terminal:

在安装Ubuntu时设置加密的主目录时,交换分区也将被加密。 设置主目录加密后,您还需要设置交换加密。 为此,请在终端中运行以下命令:

sudo ecryptfs-setup-swap

须藤ecryptfs-setup-swap

image

Note that an encrypted swap won’t work properly with Ubuntu’s hibernate feature – which is disabled by default, anyway.

请注意,加密交换不能与Ubuntu的Hibernate功能一起正常使用-默认情况下该功能已禁用。

image

清理 (Clean Up)

After restarting your system once or twice and verifying everything works properly, you can clean everything up. In addition to deleting the user account, you can remove the backup home folder located in your system’s /home directory.

重新启动系统一次或两次并验证一切正常后,即可清理所有内容。 除了删除用户帐户外,您还可以删除系统/ home目录中的备份主文件夹。

image

You’ll have to remove the backup directory from a terminal with a command like the following one. Be very careful when using this command – you could accidentally delete your real home folder or another important system directory if you type the directory name wrong:

您必须使用以下命令从终端中删除备份目录。 使用此命令时要非常小心–如果您输入错误的目录名称,可能会意外删除您的真实主目录或另一个重要的系统目录:

sudo rm -rf /home/user.random

须藤rm -rf /home/user.random

翻译自: https://www.howtogeek.com/116032/how-to-encrypt-your-home-folder-after-installing-ubuntu/

ubuntu文件夹加密

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值