我对正在进行的程序进行了一些更改,并且我已经将Java从Java 6更新为Java 7.
我在CentOS 5.8 32位VM上运行程序.
在Java更新之前,它工作正常.
现在该过程不是以错误开头的:
[root@CentOS-58-i-0 bin]# ./agent.sh start
Starting Agent.....d. running (23442).
Error: dl failure on line 864
Error: failed /agent/jre/lib/i386/client/libjvm.so,
because /agent/jre/lib/i386/client/libjvm.so:
cannot restore segment prot after reloc: Permission denied
Run Code Online (Sandbox Code Playgroud)
我已经在线检查过,解决方案/解决方法就是运行命令:
setenforce 0
Run Code Online (Sandbox Code Playgroud)
它会起作用.
阅读setenforce命令的文档,我不明白它的作用以及它是如何解决问题的.
所以我的问题是:
setenforce命令会解决它?setenforce一般情况.我已将uWSGI配置为在unix套接字上提供我的Django应用程序,并将Nginx配置为此套接字的代理.服务器正在运行CentOS 7.我想我已经配置了Nginx,因此它有权读取和写入uWSGI的套接字,但我仍然得到一个权限被拒绝错误.为什么Nginx无法访问CentOS 7上的uWSGI套接字?
[uwsgi]
socket=/socket/uwsgi.sock
virtualenv=/home/site/virtsite/
chdir=/home/site/wsgitest/
module=wsgitest.wsgi:application
vhost = true
master=True
workers=8
chmod-socket=666
pidfile=/home/site/wsgitest/uwsgi-master.pid
max-requests=5000
chown-socket=nginx:nginx
uid = nginx
gid = nginx
listen.owner = nginx
listen.group = nginx
Run Code Online (Sandbox Code Playgroud)
server {
listen 80;
location / {
uwsgi_pass unix:///home/site/wsgitest/uwsgi.sock;
include uwsgi_params;
}
}
Run Code Online (Sandbox Code Playgroud)
uwsgi --ini uwsgi.ini (as root)
ls -l /home/site/wsgitest/uwsgi.sock
srwxrwxrwx. 1 nginx nginx 0 Oct 13 10:05 uwsgi.sock
Run Code Online (Sandbox Code Playgroud)
2014/10/12 19:01:44 [crit] 19365#0: *10 connect() to unix:///socket/uwsgi.sock failed (13: Permission denied) while connecting to upstream, client: 2.191.102.217, server: , request: …Run Code Online (Sandbox Code Playgroud) 我一直在寻找SEAndroid,并且一直在尝试了解过程域是如何给出的。
到目前为止,我得到的是init.rc文件中的某些服务声明下,有一个称为seclabel的令牌:
service adbd /sbin/adbd --root_seclabel=u:r:su:s0
class core
socket adbd stream 660 system system
disabled
seclabel u:r:adbd:s0
Run Code Online (Sandbox Code Playgroud)
setexeccon将稍后在init.c中设置为所写的上下文:
if (svc->seclabel) {
if (is_selinux_enabled() > 0 && setexeccon(svc->seclabel) < 0) {
ERROR("cannot setexeccon('%s'): %s\n", svc->seclabel, strerror(errno));
_exit(127);
}
}
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,域将为adbd。
但是我没有发现服务声明中没有seclabel令牌时会发生什么。init.c中发生的事情是它不会调用setexeccon,这意味着..保留父域?
致电至:
ps -Z
Run Code Online (Sandbox Code Playgroud)
在adb shell中,它显示了所有进程及其域,否则显示。
For example, the servicemanager in init.rc:
class core
user system
group system
critical
onrestart restart healthd
onrestart restart zygote
onrestart restart media
onrestart restart surfaceflinger
onrestart restart drm
Run Code Online (Sandbox Code Playgroud)
但是调用ps -Z显示:
u:r:servicemanager:s0 system 53 1 /system/bin/servicemanager …Run Code Online (Sandbox Code Playgroud) 我在syslog中看到这些消息弹出:
Mar 10 12:51:35 db1 kernel: [5851729.958138] type=1400 audit(1457614295.823:2925931): avc: denied { name_connect } for pid=801 comm="haproxy" dest=7778 scontext=system_u:system_r:haproxy_t:s0 tcontext=system_u:object_r:interwise_port_t:s0 tclass=tcp_socket
Run Code Online (Sandbox Code Playgroud)
这是否意味着SELinux拒绝与haproxy的连接?
谢谢
我无法在我的apache webserver目录中写入文件.我正在使用CentOS 7.我正在尝试使用exec从PHP文件执行git命令:
exec("/usr/local/bin/git -C ../myRepo fetch 2>&1", $output, $exec_return_value);
Run Code Online (Sandbox Code Playgroud)
通过打印输出我看到错误表现为:
error: cannot open .git/FETCH_HEAD: Permission denied
Run Code Online (Sandbox Code Playgroud)
我发现(在这个博客的帮助下:http://jondavidjohn.com/git-pull-from-a-php-script-not-so-simple/)这是"预期的",因为Apache将使用不同的用户执行我通过ssh使用的.所以我需要确保我的权限允许该用户具有写访问权限.
我确定我的Apache安装通过在我的php文件中打印输出来作为名为"apache"的用户执行:
exec("whoami", $debugOutput, $debugRetVal);
Run Code Online (Sandbox Code Playgroud)
我也按照同一链接中的建议设置了SSH.但不幸的是我在PHP文件中仍然遇到同样的错误:
error: cannot open .git/FETCH_HEAD: Permission denied
Run Code Online (Sandbox Code Playgroud)
真正让我感到震惊的是,当我使用以下命令从我的ssh会话作为apache运行时,我没有任何权限问题:
sudo -u apache /usr/local/bin/git -C ../myRepo fetch
Run Code Online (Sandbox Code Playgroud)
用户"apache"在从PHP执行时看似具有不同的权限.有人可以帮我解决这个问题吗?
剧本:
---
- name: Update repositories cache
apt: update_cache=yes
- name: Install build-essential
apt: name=build-essential state=present
- name: Disable SELinux
selinux: state=disabled
Run Code Online (Sandbox Code Playgroud)
结果:
TASK [common : Update repositories cache] ***************************************************************************************************************************************************************************************************
changed: [server]
TASK [common : Install build-essential] *****************************************************************************************************************************************************************************************************
ok: [server]
TASK [common : Disable SELinux] *************************************************************************************************************************************************************************************************************
fatal: [server]: FAILED! => {"changed": false, "failed": true, "msg": "libselinux-python required for this module"}
Run Code Online (Sandbox Code Playgroud)
我试图找到libselinux-python但似乎不存在.当我尝试其他一些库时python-selinux,无法在系统上安装.
在 Centos 和 selinux 上使用 docker 来挂载卷时,我们必须使用:z
类似的东西
docker run -ti -v /home/my-file.txt:/tmp/my-file.txt:z alpine sh
但是我们如何通过 docker-compose 使用相同的功能
我的应用程序的目的是有根的Android设备,它具有超级用户权限,需要访问该目录/dev/input,但为什么它抛出opendir failed, Permission denied,甚至/dev/input已是chmod到777?
我使用以下代码获取root特权:
Process root = Runtime.getRuntime().exec("su");
Run Code Online (Sandbox Code Playgroud)
并使用以下代码更改以下权限/dev/input:
Shell.runCommand("chmod 777 /dev/input");
Run Code Online (Sandbox Code Playgroud)
以上两个步骤都成功,但是为什么我的应用程序仍无法访问它?通过搜索,有人说应用程序的运行时权限与文件系统中文件的权限无关。Android运行时的权限系统是什么?如何使应用程序能够访问/dev/input?
加成:
我的测试环境是Android 5.1.1,代码的主要部分是:
jint Java_com_foo_funnyapp_Native_scanInputDevicesJNI(JNIEnv* env, jclass clazz)
{
const char *dirname = "/dev/input";
DIR *dir;
dir = opendir(dirname); // opendir failed, Permission denied
if(dir == NULL)
return -1;
......
return 0;
}
Run Code Online (Sandbox Code Playgroud)
SELinux错误来自 /prog/kmsg
<36>[19700411_05:32:43.957165]@0 type=1400 audit(8631163.939:1105): avc: denied { write } for pid=15706 comm="app_process64_o" name="system@framework@boot.art" dev="mmcblk0p43" ino=442379 scontext=u:r:shell:s0 tcontext=u:object_r:dalvikcache_data_file:s0 tclass=file …Run Code Online (Sandbox Code Playgroud) 我试图在CentOS7上运行zabbix-agent 3.0.4,systemd无法启动zabbix代理,来自 journalctl -xe
PID file /run/zabbix/zabbix_agentd.pid not readable (yes?) after start.
node=localhost.localdomain type=SERVICE_START msg=audit(1475848200.601:17994): pid=1 uid=0 auid=4294967298 ses=...
zabbix-agent.service never wrote its PID file. Failing.
Failed to start Zabbix Agent.
没有权限错误,我尝试重新配置PID路径/tmp文件夹中zabbix-agent.service和zabbix_agentd.conf,这是行不通的.
很奇怪,有人有想法吗?先感谢您.
=====
调查一下,PID应该在/run/zabbix文件夹下,我手动创建zabbix_agentd.pid,并在1秒后消失.真的很奇怪.
通常在 ubuntu 中更改所有权www-data和775权限可以解决此问题。但在 centos 8 中这似乎还不够。我所做的是——
什么都不起作用。该怎么办才能解决这个问题呢?