웹사이트 검색

Debian 8에서 EncFS로 데이터를 암호화하는 방법(Jessie)


이 튜토리얼은 다음 OS 버전에 대해 존재합니다.

  • 데비안 7(Wheezy)
  • 데비안 6(Squeeze)

이 페이지에서

  1. 1 서문
  2. 2 EncFS 설치
  3. 3 EncFS 사용
  4. 4 encfs 볼륨 마운트 및 마운트 해제\n
  5. 5 encfs 암호 변경\n
  6. 6개의 링크

EncFS는 사용자 공간에서 암호화된 파일 시스템을 제공합니다. 특별한 권한 없이 실행되며 FUSE 라이브러리와 Linux 커널 모듈을 사용하여 파일 시스템 인터페이스를 제공합니다. 암호화된 블록 장치가 아니라 통과 파일 시스템이므로 기존 파일 시스템 위에 생성됩니다. 이 튜토리얼은 Debian Jessie에서 EncFS를 사용하여 데이터를 암호화하는 방법을 보여줍니다.

1 서문

이 튜토리얼에서 Debian Jessie 시스템까지 사용자 이름을 사용하고 있습니다.

2 EncFS 설치

서버 또는 데스크톱에서 루트 사용자로 로그인하면 원격 서버를 사용할 때 예를 들어 다음을 수행할 수 있습니다. SSH로 로그인합니다. EncFS는 다음과 같이 apt로 설치할 수 있습니다(루트 권한 필요).

apt-get -y install encfs

다음과 같은 경고가 표시됩니다.

Encfs security information

According to a security audit by Taylor Hornby (Defuse Security), the current implementation of Encfs is vulnerable or potentially vulnerable to multiple types of attacks. For example, an attacker with read/write access to encrypted data might lower the decryption complexity for subsequently encrypted data without this being noticed by a legitimate user, or might use timing analysis to deduce information.

Until these issues are resolved, encfs should not be considered a safe home for sensitive data in scenarios where such attacks are possible.

encfs는 대규모 조직이나 정부를 위해 데이터를 암호화하거나 위에 설명된 방식으로 제3자가 데이터에 대한 쓰기 액세스 권한이 있는 서버에서 사용하기 위한 솔루션이 아닐 수 있지만 여전히 개인용으로 충분히 안전해야 합니다. 데스크탑. encfs를 사용하기로 결정할 때 이 점을 고려하십시오.

지금 옵션에 익숙해지려면 EncFS 매뉴얼 페이지를 살펴보는 것이 좋습니다.

man encfs

3 EncFS 사용

이제 내 홈 디렉토리에서 암호화 및 해독된 디렉토리를 생성합니다.

mkdir -p ~/encrypted
mkdir -p ~/decrypted

해독된 디렉터리는 암호화된 디렉터리의 마운트 지점 역할을 합니다. ~/encrypted를 ~/decrypted로 마운트하려면 다음을 실행하십시오.

encfs ~/encrypted ~/decrypted

이 명령을 처음으로 실행하면 EncFS 설정이 시작되고 암호화된 볼륨에 대한 암호를 정의해야 합니다.

:~$ encfs ~/encrypted ~/decrypted
Creating new encrypted volume.
Please choose from one of the following options:
enter "x" for expert configuration mode,
enter "p" for pre-configured paranoia mode,
anything else, or an empty line will select standard mode.
?> <-- p
Paranoia configuration selected.
Configuration finished. The filesystem to be created has
the following properties:
Filesystem cipher: "ssl/aes", version 3:0:2
Filename encoding: "nameio/block", version 3:0:1
Key Size: 256 bits
Block Size: 1024 bytes, including 8 byte MAC header
Each file contains 8 byte header with unique IV data.
Filenames encoded using IV chaining mode.
File data IV is chained to filename IV.
File holes passed through to ciphertext.
-------------------------- WARNING --------------------------
The external initialization-vector chaining option has been
enabled. This option disables the use of hard links on the
filesystem. Without hard links, some programs may not work.
The programs 'mutt' and 'procmail' are known to fail. For
more information, please see the encfs mailing list.
If you would like to choose another configuration setting,
please press CTRL-C now to abort and start over.
Now you will need to enter a password for your filesystem.
You will need to remember this password, as there is absolutely
no recovery mechanism. However, the password can be changed
later using encfsctl.
New Encfs Password: <-- enter a secure password
Verify Encfs Password: <-- enter a secure password
:~$

암호를 잊어버리면 암호화된 데이터를 복구할 수 있는 방법이 없으므로 암호를 기억해두십시오!

이제 다음의 출력에서 EncFS 볼륨을 찾아야 합니다.

mount
:~$ mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,relatime,size=10240k,nr_inodes=125548,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,relatime,size=204216k,mode=755)
/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered,jqfmt=vfsv0,usrjquota=aquota.user,grpjquota=aquota.group)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=23,pgrp=1,timeout=300,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
rpc_pipefs on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
encfs on /home/till/decrypted type fuse.encfs (rw,nosuid,nodev,relatime,user_id=5004,group_id=5005,default_permissions)

그리고

df -h
:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 57G 2.2G 52G 5% /
udev 10M 0 10M 0% /dev
tmpfs 200M 4.7M 195M 3% /run
tmpfs 499M 0 499M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 499M 0 499M 0% /sys/fs/cgroup
encfs 57G 2.2G 52G 5% /home/till/decrypted

데이터를 암호화된 형식으로 저장하려면 일반 디렉터리에서 하는 것처럼 데이터를 해독된 디렉터리에 넣습니다.

cd ~/decrypted
echo "hello foo" > foo
echo "hello bar" > bar
ln -s foo foo2

디렉토리의 내용을 확인하면 암호화되지 않은 형태로 볼 수 있음을 알 수 있습니다...

ls -l
:~/decrypted$

... 암호화된 디렉터리에 있는 동안 다음과 같이 암호화됩니다.

cd ~/encrypted
ls -l
:~/encrypted$

4 encfs 볼륨 마운트 및 마운트 해제

암호화된 볼륨을 마운트 해제하려면 다음을 실행하십시오.

cd
fusermount -u ~/decrypted

의 출력을 확인하십시오...

mount

... 그리고...

df -h

... 그러면 EncFS 볼륨이 더 이상 나열되지 않는 것을 볼 수 있습니다.

다시 마운트하려면 다음을 실행하십시오.

encfs ~/encrypted ~/decrypted

이전에 정의한 비밀번호를 묻는 메시지가 표시됩니다.

[이메일 보호됨]:~$

올바른 암호를 지정하면 ~/encrypted 디렉토리가 ~/decrypted에 마운트되어 암호화되지 않은 형식으로 암호화된 데이터에 액세스할 수 있습니다. 암호를 잊어버리면 암호화된 데이터가 손실됩니다!

5 encfs 비밀번호 변경

비밀번호를 변경하고 싶다면 다음을 사용하여 변경할 수 있습니다.

encfsctl passwd ~/encrypted

명령.

[email :~$encfsctl passwd ~/encrypted
현재 Encfs 비밀번호 입력
EncFS 비밀번호: <-- yoursecretpassword
새 Encfs 비밀번호 입력
새 Encfs 비밀번호: <-- newsecretpassword
Encfs 비밀번호 확인: <-- newsecretpassword
볼륨 키가 성공적으로 업데이트되었습니다.

6 링크

  • EncFS: http://www.arg0.net/encfs
  • 데비안: http://www.debian.org/