encrypt / decrypt a folder by ecryptfs for special user only

441 Views Asked by At

can i encrypt a folder and decrypt it only for special user by encrypts tools in Linux? in this case other users can not view files in decrypted folder. a way is using permissions to access folder but has another way?

2

There are 2 best solutions below

0
On

No, this is not possible because access permissions suffice as stated explicitly in the ecryptfs FAQ.

0
On

You might also try this mounting option - ecryptfs_check_dev_ruid, it forces ownership check on mounted directory. From main.c:

if (check_ruid && !uid_eq(path.dentry->d_inode->i_uid, current_uid())) {
    rc = -EPERM;
    printk(KERN_ERR "Mount of device (uid: %d) not owned by "
           "requested user (uid: %d)\n",
        i_uid_read(path.dentry->d_inode),
        from_kuid(&init_user_ns, current_uid()));
    goto out_free;
}