[완료][질문] 파일 삭제가 안됩니다. selinux 때문인지.

nonots의 이미지

파일이 삭제가 안됩니다.
httpd 를 설치하려는데 suexec 때문에 안되어서
suexec 를 rm 로 삭제하려는데 삭제도 안되네요

지금
selinux 가 disabled 상태인데
이거 왜그런가요?
..
..

[root ~]# rpm -Uvh httpd-2.2.3-43.el5.centos.3.x86_64.rpm
Preparing... ########################################### [100%]
1:httpd ########################################### [100%]
error: unpacking of archive failed on file /usr/sbin/suexec: cpio: rename failed - Operation not permitted

[root ~]# sestatus
SELinux status: disabled

[root ~]# ls -alZ /usr/sbin/suexec
-r-x--x--- root apache system_u:object_r:httpd_suexec_exec_t:s0 /usr/sbin/suexec

[root ~]# rm -f /usr/sbin/suexec
rm: cannot remove `/usr/sbin/suexec': Operation not permitted

[root ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted

rogon3의 이미지

su 엔터, 암호 물어보면 입력하고 suexec --help 등 실행시켜보세요

지우면 안될 것 같습니다만, 제 컴퓨터가 아니므로 스스로 다시 생각해도 지워야 하는 파일이라고 판단되면 루트상태일테니 (su)

chmod a+rw /usr/sbin/suexec

rm /usr/sbin/suexec 하시면 삭제 될 듯.

*******************************
데비안과 세벌식 사용자입니다

*************************************

nonots의 이미지

수동으로 설치한 httpd 에 있던건데.. 이걸
rpm 으로 재설치하려고 합니다.
..
재설치하려고 하니 이전에 설치한 suexec 가 삭제되지 않는군요

[root ~]# /usr/sbin/suexec
suexec policy violation: see suexec log for more details

이런 메시지가 나옵니다. 실행하면.


=== 건달의 경지를 꿈꾸며 ===

rogon3의 이미지

첫줄 답글은 제가 틀린 답입니다.

볼수록 절묘하게 실행권한이 root에게는 없네요

삭제는 위 언급한 방법으로 가능할 겁니다.

*******************************
데비안과 세벌식 사용자입니다

*************************************

nonots의 이미지

[root sbin]# chmod a+rw ./suexec
chmod: changing permissions of `./suexec': Operation not permitted

..
이렇게 나오는군요..


=== 건달의 경지를 꿈꾸며 ===

rogon3의 이미지

변경못하게 속성 집어넣은 것 같습니다.

lsattr suexec 해서 맨 앞의 ---------- 점 사이에 들어 있는 문자가 뭔지 보세요

*******************************
데비안과 세벌식 사용자입니다

*************************************

nonots의 이미지

[root ~]# lsattr /usr/sbin/suexec
-u--ia------- /usr/sbin/suexec

이렇게 나오는군요..

root ~]# chattr -iau /usr/sbin/suexec
[root ~]# rm /usr/sbin/suexec
rm: remove regular file `/usr/sbin/suexec'? y
[root ~]# ls /usr/sbin/suexec
ls: /usr/sbin/suexec: No such file or directory

..
됐군요..
.. 이 문제인걸 계속 selinux 만 의심했네요..
..
감사합니다.


=== 건달의 경지를 꿈꾸며 ===

rogon3의 이미지

다행입니다.

*******************************
데비안과 세벌식 사용자입니다

*************************************