今天在运行一个软件时,遇到这样一个错误:
cannot restore segment prot after reloc
解决方法:
运行命令:chcon -t textrel_shlib_t file_name
chcon命令:
修改对象(文件)的安全上下文
命令格式:
Chcon [OPTIONS…] CONTEXT FILES…..
Chcon [OPTIONS…] –reference=PEF_FILES FILES…
说明:
CONTEXT 为要设置的安全上下文
FILES 对象(文件)
--reference 参照的对象
PEF_FILES 参照文件上下文
FILES 应用参照文件上下文为我的上下文。
OPTIONS 如下:
-f 强迫执行
-R 递归地修改对象的安全上下文
-r ROLE 修改安全上下文角色的配置
-t TYPE 修改安全上下文类型的配置
-u USER 修改安全上下文用户的配置
-v 显示冗长的信息
chcon --help
Usage: chcon [OPTION]... CONTEXT FILE...
or: chcon
[OPTION]... [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...
or: chcon
[OPTION]... --reference=RFILE FILE...
Change the security context of each FILE to CONTEXT.
-c, --changes
like
verbose but report only when a change is made
-h,
--no-dereference affect
symbolic links instead of any referenced file
(available
only on systems with lchown system call)
-f, --silent,
--quiet suppress most error
messages
--reference=RFILE use
RFILE's group instead of using a CONTEXT value
-u,
--user=USER
set user USER
in the target security context
-r,
--role=ROLE
set role ROLE
in the target security context
-t,
--type=TYPE
set type TYPE
in the target security context
-l,
--range=RANGE
set range
RANGE in the target security context
-R,
--recursive
change files
and directories recursively
-v, --verbose
output a
diagnostic for every file processed
--help
display
this help and exit
--version
output
version information and exit
示例:
1、chcon -t texrel_shlib_t file_name
2、chcon -t textrel_shlib_t file_name
阅读(3248) | 评论(0) | 转发(0) |