如何增加 Ubuntu 对加密目录的 143 字节文件名限制?

Bip*_*ark 14 encryption filename

在加密目录中,Ubuntu(至少15.10)似乎有143B的文件名字节限制——比ext4文件系统的255B的限制要小得多。这个特殊限制在哪里设置,为什么首先设置,有没有办法增加它?

Rin*_*ind 10

Ubuntu限制在哪里设置,

这是一个文件系统限制。所有“ext”都有 255 个字符的限制。这是许多文件系统的列表。ReiserFS 显示 4032 字节(但由于Linux VFS限制为 255 个字符)。

加密文件的 144 个字符限制不正确。它是 143(来自 ecryptfs 实用程序的创建者)。加密需要剩余的字符,因此您无法对其进行检查(加密不适用于超过 143 个字符的文件)。

有没有办法增加它?


还有一些信息。这些将以字符显示文件和目录大小限制:

 getconf NAME_MAX /dev/sda
 getconf PATH_MAX /dev/sda
Run Code Online (Sandbox Code Playgroud)

有关/usr/include/linux/limits.h这 2 个变量的声明,请参见:

#ifndef _LINUX_LIMITS_H
#define _LINUX_LIMITS_H

#define NR_OPEN         1024

#define NGROUPS_MAX    65536    /* supplemental group IDs are available */
#define ARG_MAX       131072    /* # bytes of args + environ for exec() */
#define LINK_MAX         127    /* # links a file may have */
#define MAX_CANON        255    /* size of the canonical input queue */
#define MAX_INPUT        255    /* size of the type-ahead buffer */
#define NAME_MAX         255    /* # chars in a file name */
#define PATH_MAX        4096    /* # chars in a path name including nul */
#define PIPE_BUF        4096    /* # bytes in atomic write to a pipe */
#define XATTR_NAME_MAX   255    /* # chars in an extended attribute name */
#define XATTR_SIZE_MAX 65536    /* size of an extended attribute value (64k) */
#define XATTR_LIST_MAX 65536    /* size of extended attribute namelist (64k) */

#define RTSIG_MAX     32

#endif
Run Code Online (Sandbox Code Playgroud)

您可以更改此值,但您至少需要重新编译 fopen() 函数才能使用它。并且不会与任何其他操作系统兼容。

所以我把我的答案改为:是的,你可以,但请不要:)