Linux/Linux-OS

could not chdir to home directory /home/{user name} permission denied

레이루이 2023. 8. 4. 10:34
반응형

이런 메시지가 출력될 경우 구글링을 해보면

 

   1) 계정의 홈 디렉터리를 생성해 주라던지, 

   2) 계정의 퍼미션을 설정해 주거나,

   3) ownership을 설정해주라고 검색이 된다.

 

ex)

chown -R test /home/test
chmod 755 /home/test

 

하지만 이러한 방법으로도 해결이 되지 않는 경우가 있으니 바로 나와 같은 경우이다.

나의 경우에는 KVM 환경의 Fedora 11 OS를 VMware의 환경으로 포팅하는 작업중에 출력된 경우이다.

여러 경우를 확인해 봤지만 해결이 안되서 고민하던 차에 selinux 모드를 확인해 보니 enforcing 상태였다.

 

# getenforce

Enforcing

 

그래서 임시로 setenforce 0 명령어로 전환후 확인해보니 정상 작동하였다.

config 파일을 수정하여 영구적으로 적용하기 위해서는 아래 명령어로 파일을 연 다음 보기와 같이 수정하면 된다.

(주의: 보안 때문에 권장하지는 않는 방법입니다)

 

vim /etc/sysconfig/selinux

 

[root@hosting147 ~]# 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 - No SELinux policy is loaded.
#SELINUX=enforcing
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
#       targeted - Targeted processes are protected,
#       mls - Multi Level Security protection.
SELINUXTYPE=targeted

 

반응형