간단한 실험:permission denied

Atmosphere·2025년 10월 10일

간단한 실험

목록 보기
1/1
post-thumbnail

간단한 실험. 사용자 gut 디렉토리에 testdir/a.txt를 만들고 이걸 test라는 사용자에서 접근해보기

mkdir testdir
touch testdir/a.txt
chmod 600 testdir/a.txt
su test
cat testdir/a.txt

이 상태로 접근해보려고 하면 당연히 이렇게 permission denied가 뜬다.

문제1. testdir 디렉토리에 대한 other 접근 권한이 부여되지 않음
문제2. a.txt에 대한 other 접근 권한이 부여되지 않음

그래서 chmod 605 testdir(읽기권한r+실행권한x)로 바꿔주면

읽기권한과 실행권한을 추가해주어 ls로 접근이 잘 되는것을 확인할 수 있다.

이제 chmod 704 testdir/a.txt로 a.txt파일을 읽을 수 있는 읽기 권한 까지 주면

(a.txt는 빈 파일이다)
문제없이 접근이 잘 된다.

profile
작게, 빠르게, 지속가능하게

0개의 댓글