rw/ro 및 root_squash 옵션에 따른 접근 제어와 성능을 테스트하는 방법을 정리한 가이드입니다.nobody는 리눅스 시스템에서 권한이 가장 낮은 익명 사용자를 의미합니다.| 용어 | 설명 |
|---|---|
| NFS 서버 | 파일을 공유하는 주체. /etc/exports 파일로 공유 디렉터리 정의 |
| NFS 클라이언트 | 공유된 디렉터리를 네트워크를 통해 마운트하여 사용하는 시스템 |
| root_squash | 클라이언트의 root 사용자를 서버의 nobody 사용자로 매핑 (보안 강화용) |
| no_root_squash | root 계정을 그대로 유지 (보안 위험 높음, 테스트 환경용) |
| sync / async | sync는 안정적이지만 느리고, async는 빠르지만 비정상 종료 시 데이터 유실 가능 |
| UID/GID 매핑 | 클라이언트와 서버의 사용자 ID가 일치해야 동일 권한으로 접근 가능 |
| 옵션 | 설명 |
|---|---|
| rw | 읽기/쓰기 허용 |
| ro | 읽기 전용 |
| sync | 데이터가 디스크에 기록될 때까지 응답 지연 (안정적) |
| async | 메모리에 먼저 기록 후 응답 (빠르지만 위험) |
| root_squash | 클라이언트 root → 서버 nobody로 매핑 |
| no_root_squash | 클라이언트 root를 그대로 유지 |
| all_squash | 모든 사용자 → nobody로 매핑 |
| anonuid / anongid | 익명 사용자(nobody)의 UID/GID를 명시적으로 지정 |
| secure | 1024 이하 포트에서만 접근 허용 (기본값) |
| insecure | 높은 포트에서도 접근 허용 |
| wdelay | 여러 쓰기 요청을 모아 한 번에 기록 (성능 향상) |
| no_subtree_check | 서브 디렉터리 확인 비활성화 (성능 향상) |
| 옵션 | 설명 |
|---|---|
| vers=3 / vers=4 | NFS 버전 지정 |
| rw / ro | 읽기/쓰기 또는 읽기 전용 |
| sync / async | 서버와 동일 의미 |
| hard / soft | 서버 응답 지연 시 처리 방식 (hard는 계속 재시도, soft는 에러 반환) |
| timeo=n | 타임아웃 시간 설정 (기본 600 = 60초) |
| intr | 서버 응답이 없을 때 작업 중단 가능 |
| nolock | 파일 잠금(lock) 기능 비활성화 |
| noatime | 파일 접근 시 접근시간(atime) 갱신하지 않음 (성능 향상) |
# dnf -y install nfs-utils # systemctl enable --now nfs-server # mkdir -p /nfs/{rw_squash,ro_squash,rw_no_squash,ro_no_squash} # chmod 777 /nfs/{rw_squash,ro_squash} # vim /etc/exports 설정 예시:
/nfs/rw_squash 192.168.204.0/24(rw,async,root_squash)
/nfs/ro_squash 192.168.204.0/24(ro,sync,root_squash)
/nfs/rw_no_squash 192.168.204.231(rw,sync,no_root_squash)
/nfs/ro_no_squash 192.168.204.231(ro,sync,no_root_squash) # exportfs -ra # exportfs -v 출력 예시:
/nfs/rw_no_squash 192.168.204.231(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,no_root_squash,no_all_squash)
/nfs/ro_no_squash 192.168.204.231(sync,wdelay,hide,no_subtree_check,sec=sys,ro,secure,no_root_squash,no_all_squash)
/nfs/rw_squash 192.168.204.0/24(sync,wdelay,hide,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
/nfs/ro_squash 192.168.204.0/24(sync,wdelay,hide,no_subtree_check,sec=sys,ro,secure,root_squash,no_all_squash) # firewall-cmd --list-services 출력 예시:
cockpit dhcpv6-client ntp ssh # firewall-cmd --permanent --add-service=nfs --add-service=rpc-bind --add-service=mountd
# firewall-cmd --reload # firewall-cmd --list-services 출력 예시:
cockpit dhcpv6-client mountd nfs ntp rpc-bind ssh # dnf -y install nfs-utils # mkdir -p /nfs/{rw_squash,ro_squash,rw_no_squash,ro_no_squash} # mount -t nfs -o vers=3,rw,async 192.168.204.230:/nfs/rw_squash /nfs/rw_squash
# mount -t nfs -o vers=3,ro,sync 192.168.204.230:/nfs/ro_squash /nfs/ro_squash # vim /etc/fstab 설정 예시:
192.168.204.230:/nfs/rw_no_squash /nfs/rw_no_squash nfs rw,async,vers=3 0 0
192.168.204.230:/nfs/ro_no_squash /nfs/ro_no_squash nfs ro,async,vers=3 0 0 # systemctl daemon-reload
# mount -a # df -Th | grep nfs 출력 예시:
192.168.204.230:/nfs/rw_squash nfs 252G 14G 239G 6% /nfs/rw_squash
192.168.204.230:/nfs/ro_squash nfs 252G 14G 239G 6% /nfs/ro_squash
192.168.204.230:/nfs/rw_no_squash nfs 252G 14G 239G 6% /nfs/rw_no_squash
192.168.204.230:/nfs/ro_no_squash nfs 252G 14G 239G 6% /nfs/ro_no_squash root_squash : root 사용자를 nobody로 매핑 → 보안 강화no_root_squash : root 그대로 유지 → 테스트 환경 전용# echo "rw,ro test" >> /nfs/rw_squash/rw_ro_test
# echo "rw,ro test" >> /nfs/rw_no_squash/rw_ro_test
# echo "rw,ro test" >> /nfs/ro_squash/rw_ro_test 출력 예시:
-bash: /nfs/ro_squash/rw_ro_test: Read-only file system # echo "rw,ro test" >> /nfs/ro_no_squash/rw_ro_test 출력 예시:
-bash: /nfs/ro_no_squash/rw_ro_test: Read-only file system # ls -al /nfs/rw_squash/rw_ro_test 출력 예시:
-rw-r--r-- 1 nobody nobody 11 Oct 18 16:52 /nfs/rw_squash/rw_ro_test # ls -al /nfs/rw_no_squash/rw_ro_test 출력 예시:
-rw-r--r-- 1 root root 11 Oct 18 16:52 /nfs/rw_no_squash/rw_ro_test async는 빠르지만 데이터 유실 가능성 존재sync는 안전하지만 I/O 속도는 느림# time dd if=/dev/zero of=/nfs/rw_squash/file bs=1M count=100 출력 예시:
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.398387 s, 263 MB/s
real 0m0.426s
user 0m0.000s
sys 0m0.259s # time dd if=/dev/zero of=/nfs/rw_no_squash/file bs=1M count=100 출력 예시:
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.975371 s, 108 MB/s
real 0m1.005s
user 0m0.000s
sys 0m0.432s https://youtu.be/4MVxzmepY3s 1. 개요 리눅스에서 정기적으로 실행되는 작업(백업, 로그 정리, 모니터링 등)은 cron 서비스를 통해 자동화할 수 있습니다.…
https://youtu.be/vPfxWFBE1yc 1. 개요 리눅스 서버를 운영할 때 사용자 계정 생성, 비밀번호 설정, 권한 부여, 계정…
https://youtu.be/Gvp2XwBfoKw 1. 개요 리눅스 서버에서는 시스템 시간(OS 시간) 과 하드웨어 시간(RTC, Real-Time Clock) 을 동기화하는 것이 매우 중요합니다. 클러스터…
https://youtu.be/pt9qhawl8LY 1. 개요 리눅스 서버에서는 시스템 시간(OS 시간) 과 하드웨어 시간(RTC, Real-Time Clock) 을 모두 관리할 수 있습니다. 운영체제의…
https://youtu.be/iPdHGXh7DUg 1. 개요 서버 운영 시 시스템 시간이 올바르게 설정되어 있지 않으면 로그 분석, 모니터링,…
https://youtu.be/F06CS8Encr8 1. 개요 LVM 환경에서 캐시 LV까지 포함된 볼륨 그룹(VG) 을 깨끗하게 삭제하는 과정을 다룹니다. umount…