155번 pc에 NFS 서버를 올려서 152번 클라이언트에서 사용할것이다.
일단 서버부터 설정한다.
yum
list nfs-utils
관련
파일
•
데몬 : /usr/sbin/exportfs
/usr/sbin/rpcbind
•
관리 스크립트 : /usr/lib/systemd/system/nfs.service
/usr/lib/systemd/system/rpcbind.service
•
환경 설정 파일 : /etc/exports
이전
버전은 portmap을 이용한다.
(rpcbind 대신에)
ntsysv
nfs-server.service
nfs.service
체크한 뒤 저장
systemctl
restart network
systemctl
start rpcbind
systemctl
start nfs-server
systemctl
start rpc-statd
systemctl
enable rpcbind
systemctl
enable nfs-server
systemctl
status nfs-server
vi
/etc/exports
/home/a1
192.168.10.152(rw,no_root_squash)
/home/a2
192.168.10.152(rw,all_squash)
/home/a3
192.168.10.152(rw,no_all_squash)
/home/a4
192.168.10.152(rw,all_squash,root_squash)
/home/a5
192.168.10.152(rw,all_squash,no_root_squash)
/home/a6
192.168.10.152(rw,no_all_squash,root_squash)
/home/a7
192.168.10.152(rw,no_all_squash,no_root_squash)
/home/a8
192.168.10.152(rw,anonuid=##,anongid=##)
adduser
-p 1000 a1
adduser
-p 1001 a2
확인은 cat /etc/passwd
이런식으로 호스트와 서버의 ID와 PID를 매핑시켜준다
그리고 실습을 위해 권한을 주어야 한다.
chmod
777 -R /home
클라이언트 서버에서 마운트를 진행한다.
mount -t
nfs 192.168.10.155:/home/a1 /home/a1
mount -t
nfs 192.168.10.155:/home/a2 /home/a2
mount -t
nfs 192.168.10.155:/home/a3 /home/a3
mount -t
nfs 192.168.10.155:/home/a4 /home/a4
mount -t
nfs 192.168.10.155:/home/a5 /home/a5
mount -t
nfs 192.168.10.155:/home/a6 /home/a6
mount -t
nfs 192.168.10.155:/home/a7 /home/a7
df
-h
이제 각자 계정으로 들어가서 작업을 해본다.
a1
/home/a1
192.168.10.152(rw,no_root_squash)
읽고 쓰는 권한을 주고 클라이언트와 서버의 root를 일치 시킨다.
root로 들어가서 만들면 NFS 서버의 root 권한으로 만들어진다.
a2
/home/a2
192.168.10.152(rw,all_squash)
모든 사용자를 nobody로 매핑했으므로 root로 들어가도 소유자가 nobody이다.
a3
/home/a3
192.168.10.152(rw,no_all_squash)
루트 사용자로 들어가도 root는 원래 기본적으로 매핑이 불가능하다.
a4
/home/a4
192.168.10.152(rw,all_squash,root_squash)
모든 사용자를 nobody로 매핑하고 root또한 nobody로 매핑
a5
/home/a5
192.168.10.152(rw,all_squash,no_root_squash)
모든 사용자는 nobody, 클라이언트 root는 nobody 매핑
a6
/home/a6
192.168.10.152(rw,no_all_squash,root_squash)
서버사용자, 클라이언트 사용자 일치, root는 nobody로 매핑
댓글 없음:
댓글 쓰기