/ chmod 명령어

RHCE : NFS – Provide network shares suitable for group collaboration.

chmod 명령어 NFS rhce-new redhat-new rpcbind nfs-server exportfs command /etc/exports chgrp command
https://4am.kr/rhce-nfs-provide-network-shares-suitable-for-group-collaboration/

RHCE : NFS – 그룹 협업에 적합한 네트워크 공유 제공

RHCE 주제입니다. 아래 참조된 사이트를 번역 및 내용 추가하였습니다.

설정하기

1. NFS와 관련된 패키지들을 설치한다.
[root@server1 ~]# yum groupinstall -y "file-server"
Loaded plugins: fastestmirror, langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package cifs-utils.x86_64 0:6.2-6.el7 will be installed
---> Package gssproxy.x86_64 0:0.3.0-9.el7 will be installed
--> Processing Dependency: libverto-tevent for package: gssproxy-0.3.0-9.el7.x86_64
--> Processing Dependency: libini_config.so.3()(64bit) for package: gssproxy-0.3.0-9.el7.x86_64
--> Processing Dependency: libcollection.so.2()(64bit) for package: gssproxy-0.3.0-9.el7.x86_64
---> Package nfs4-acl-tools.x86_64 0:0.3.3-13.el7 will be installed
---> Package samba.x86_64 0:4.1.1-31.el7 will be installed
---> Package targetcli.noarch 0:2.1.fb34-1.el7 will be installed
--> Processing Dependency: python-rtslib >= 2.1.fb41 for package: targetcli-2.1.fb34-1.el7.noarch
--> Processing Dependency: python-ethtool for package: targetcli-2.1.fb34-1.el7.noarch
--> Processing Dependency: python-configshell for package: targetcli-2.1.fb34-1.el7.noarch
---> Package targetd.noarch 0:0.7.1-1.el7 will be installed
--> Processing Dependency: lvm2-python-libs >= 2.02.99 for package: targetd-0.7.1-1.el7.noarch
--> Processing Dependency: python-setproctitle for package: targetd-0.7.1-1.el7.noarch
--> Processing Dependency: PyYAML for package: targetd-0.7.1-1.el7.noarch
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-11.el7 will be installed
--> Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-11.el7.x86_64
---> Package libcollection.x86_64 0:0.6.2-22.el7 will be installed
---> Package libini_config.x86_64 0:1.0.0.1-22.el7 will be installed
--> Processing Dependency: libref_array.so.1()(64bit) for package: libini_config-1.0.0.1-22.el7.x86_64
--> Processing Dependency: libpath_utils.so.1()(64bit) for package: libini_config-1.0.0.1-22.el7.x86_64
--> Processing Dependency: libbasicobjects.so.0()(64bit) for package: libini_config-1.0.0.1-22.el7.x86_64
---> Package libverto-tevent.x86_64 0:0.2.5-4.el7 will be installed
---> Package lvm2-python-libs.x86_64 7:2.02.105-14.el7 will be installed
---> Package python-configshell.noarch 1:1.1.fb11-3.el7 will be installed
--> Processing Dependency: python-urwid for package: 1:python-configshell-1.1.fb11-3.el7.noarch
--> Processing Dependency: pyparsing for package: 1:python-configshell-1.1.fb11-3.el7.noarch
---> Package python-ethtool.x86_64 0:0.8-5.el7 will be installed
---> Package python-rtslib.noarch 0:2.1.fb46-1.el7 will be installed
--> Processing Dependency: python-kmod for package: python-rtslib-2.1.fb46-1.el7.noarch
---> Package python-setproctitle.x86_64 0:1.1.6-5.el7 will be installed
--> Running transaction check
---> Package libbasicobjects.x86_64 0:0.1.0-22.el7 will be installed
---> Package libpath_utils.x86_64 0:0.2.1-22.el7 will be installed
---> Package libref_array.x86_64 0:0.1.3-22.el7 will be installed
---> Package libyaml.x86_64 0:0.1.4-10.el7 will be installed
---> Package pyparsing.noarch 0:1.5.6-9.el7 will be installed
---> Package python-kmod.x86_64 0:0.9-4.el7 will be installed
---> Package python-urwid.x86_64 0:1.1.1-3.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                 Arch       Version                  Repository    Size
================================================================================
Installing for group install "파일 및 스토리지 서버":
 cifs-utils              x86_64     6.2-6.el7                RHELREPO      83 k
 gssproxy                x86_64     0.3.0-9.el7              RHELREPO      81 k
 nfs4-acl-tools          x86_64     0.3.3-13.el7             RHELREPO      47 k
 samba                   x86_64     4.1.1-31.el7             RHELREPO     527 k
 targetcli               noarch     2.1.fb34-1.el7           RHELREPO      55 k
 targetd                 noarch     0.7.1-1.el7              RHELREPO      49 k
Installing for dependencies:
 PyYAML                  x86_64     3.10-11.el7              RHELREPO     153 k
 libbasicobjects         x86_64     0.1.0-22.el7             RHELREPO      24 k
 libcollection           x86_64     0.6.2-22.el7             RHELREPO      39 k
 libini_config           x86_64     1.0.0.1-22.el7           RHELREPO      49 k
 libpath_utils           x86_64     0.2.1-22.el7             RHELREPO      27 k
 libref_array            x86_64     0.1.3-22.el7             RHELREPO      25 k
 libverto-tevent         x86_64     0.2.5-4.el7              RHELREPO     9.0 k
 libyaml                 x86_64     0.1.4-10.el7             RHELREPO      55 k
 lvm2-python-libs        x86_64     7:2.02.105-14.el7        RHELREPO     153 k
 pyparsing               noarch     1.5.6-9.el7              RHELREPO      94 k
 python-configshell      noarch     1:1.1.fb11-3.el7         RHELREPO      63 k
 python-ethtool          x86_64     0.8-5.el7                RHELREPO      33 k
 python-kmod             x86_64     0.9-4.el7                RHELREPO      57 k
 python-rtslib           noarch     2.1.fb46-1.el7           RHELREPO      75 k
 python-setproctitle     x86_64     1.1.6-5.el7              RHELREPO      15 k
 python-urwid            x86_64     1.1.1-3.el7              RHELREPO     654 k

Transaction Summary
================================================================================
Install  6 Packages (+16 Dependent packages)

Total download size: 2.3 M
Installed size: 7.3 M
Downloading packages:
경고: /var/cache/yum/x86_64/7/RHELREPO/packages/PyYAML-3.10-11.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Public key for PyYAML-3.10-11.el7.x86_64.rpm is not installed
(1/22): PyYAML-3.10-11.el7.x86_64.rpm                      | 153 kB   00:00     
(2/22): gssproxy-0.3.0-9.el7.x86_64.rpm                    |  81 kB   00:00     
(3/22): libbasicobjects-0.1.0-22.el7.x86_64.rpm            |  24 kB   00:00     
(4/22): libcollection-0.6.2-22.el7.x86_64.rpm              |  39 kB   00:00     
(5/22): libini_config-1.0.0.1-22.el7.x86_64.rpm            |  49 kB   00:00     
(6/22): libpath_utils-0.2.1-22.el7.x86_64.rpm              |  27 kB   00:00     
(7/22): libref_array-0.1.3-22.el7.x86_64.rpm               |  25 kB   00:00     
(8/22): cifs-utils-6.2-6.el7.x86_64.rpm                    |  83 kB   00:00     
(9/22): libverto-tevent-0.2.5-4.el7.x86_64.rpm             | 9.0 kB   00:00     
(10/22): lvm2-python-libs-2.02.105-14.el7.x86_64.rpm       | 153 kB   00:00     
(11/22): nfs4-acl-tools-0.3.3-13.el7.x86_64.rpm            |  47 kB   00:00     
(12/22): pyparsing-1.5.6-9.el7.noarch.rpm                  |  94 kB   00:00     
(13/22): python-configshell-1.1.fb11-3.el7.noarch.rpm      |  63 kB   00:00     
(14/22): python-ethtool-0.8-5.el7.x86_64.rpm               |  33 kB   00:00     
(15/22): python-kmod-0.9-4.el7.x86_64.rpm                  |  57 kB   00:00     
(16/22): python-rtslib-2.1.fb46-1.el7.noarch.rpm           |  75 kB   00:00     
(17/22): python-setproctitle-1.1.6-5.el7.x86_64.rpm        |  15 kB   00:00     
(18/22): python-urwid-1.1.1-3.el7.x86_64.rpm               | 654 kB   00:00     
(19/22): samba-4.1.1-31.el7.x86_64.rpm                     | 527 kB   00:00     
(20/22): targetcli-2.1.fb34-1.el7.noarch.rpm               |  55 kB   00:00     
(21/22): targetd-0.7.1-1.el7.noarch.rpm                    |  49 kB   00:00     
(22/22): libyaml-0.1.4-10.el7.x86_64.rpm                   |  55 kB   00:00     
--------------------------------------------------------------------------------
Total                                              5.5 MB/s | 2.3 MB  00:00     
Retrieving key from http://repo.example.com/repo/RPM-GPG-KEY-CentOS-7
Importing GPG key 0xF4A80EB5:
 Userid     : "CentOS-7 Key (CentOS 7 Official Signing Key) <security@centos.org>"
 Fingerprint: 6341 ab27 53d7 8a78 a7c2 7bb1 24c6 a8a7 f4a8 0eb5
 From       : http://repo.example.com/repo/RPM-GPG-KEY-CentOS-7
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libcollection-0.6.2-22.el7.x86_64                           1/22 
  Installing : libpath_utils-0.2.1-22.el7.x86_64                           2/22 
  Installing : 7:lvm2-python-libs-2.02.105-14.el7.x86_64                   3/22 
  Installing : libbasicobjects-0.1.0-22.el7.x86_64                         4/22 
  Installing : python-kmod-0.9-4.el7.x86_64                                5/22 
  Installing : python-rtslib-2.1.fb46-1.el7.noarch                         6/22 
  Installing : python-ethtool-0.8-5.el7.x86_64                             7/22 
  Installing : python-urwid-1.1.1-3.el7.x86_64                             8/22 
  Installing : libref_array-0.1.3-22.el7.x86_64                            9/22 
  Installing : libini_config-1.0.0.1-22.el7.x86_64                        10/22 
  Installing : python-setproctitle-1.1.6-5.el7.x86_64                     11/22 
  Installing : pyparsing-1.5.6-9.el7.noarch                               12/22 
  Installing : 1:python-configshell-1.1.fb11-3.el7.noarch                 13/22 
  Installing : libyaml-0.1.4-10.el7.x86_64                                14/22 
  Installing : PyYAML-3.10-11.el7.x86_64                                  15/22 
  Installing : libverto-tevent-0.2.5-4.el7.x86_64                         16/22 
  Installing : gssproxy-0.3.0-9.el7.x86_64                                17/22 
  Installing : targetd-0.7.1-1.el7.noarch                                 18/22 
  Installing : targetcli-2.1.fb34-1.el7.noarch                            19/22 
  Installing : cifs-utils-6.2-6.el7.x86_64                                20/22 
  Installing : samba-4.1.1-31.el7.x86_64                                  21/22 
  Installing : nfs4-acl-tools-0.3.3-13.el7.x86_64                         22/22 
  Verifying  : libcollection-0.6.2-22.el7.x86_64                           1/22 
  Verifying  : libverto-tevent-0.2.5-4.el7.x86_64                          2/22 
  Verifying  : libyaml-0.1.4-10.el7.x86_64                                 3/22 
  Verifying  : pyparsing-1.5.6-9.el7.noarch                                4/22 
  Verifying  : nfs4-acl-tools-0.3.3-13.el7.x86_64                          5/22 
  Verifying  : python-setproctitle-1.1.6-5.el7.x86_64                      6/22 
  Verifying  : gssproxy-0.3.0-9.el7.x86_64                                 7/22 
  Verifying  : samba-4.1.1-31.el7.x86_64                                   8/22 
  Verifying  : 1:python-configshell-1.1.fb11-3.el7.noarch                  9/22 
  Verifying  : libini_config-1.0.0.1-22.el7.x86_64                        10/22 
  Verifying  : libref_array-0.1.3-22.el7.x86_64                           11/22 
  Verifying  : cifs-utils-6.2-6.el7.x86_64                                12/22 
  Verifying  : python-urwid-1.1.1-3.el7.x86_64                            13/22 
  Verifying  : targetcli-2.1.fb34-1.el7.noarch                            14/22 
  Verifying  : python-ethtool-0.8-5.el7.x86_64                            15/22 
  Verifying  : python-kmod-0.9-4.el7.x86_64                               16/22 
  Verifying  : libbasicobjects-0.1.0-22.el7.x86_64                        17/22 
  Verifying  : python-rtslib-2.1.fb46-1.el7.noarch                        18/22 
  Verifying  : 7:lvm2-python-libs-2.02.105-14.el7.x86_64                  19/22 
  Verifying  : targetd-0.7.1-1.el7.noarch                                 20/22 
  Verifying  : PyYAML-3.10-11.el7.x86_64                                  21/22 
  Verifying  : libpath_utils-0.2.1-22.el7.x86_64                          22/22 

Installed:
  cifs-utils.x86_64 0:6.2-6.el7              gssproxy.x86_64 0:0.3.0-9.el7      
  nfs4-acl-tools.x86_64 0:0.3.3-13.el7       samba.x86_64 0:4.1.1-31.el7        
  targetcli.noarch 0:2.1.fb34-1.el7          targetd.noarch 0:0.7.1-1.el7       

Dependency Installed:
  PyYAML.x86_64 0:3.10-11.el7                                                   
  libbasicobjects.x86_64 0:0.1.0-22.el7                                         
  libcollection.x86_64 0:0.6.2-22.el7                                           
  libini_config.x86_64 0:1.0.0.1-22.el7                                         
  libpath_utils.x86_64 0:0.2.1-22.el7                                           
  libref_array.x86_64 0:0.1.3-22.el7                                            
  libverto-tevent.x86_64 0:0.2.5-4.el7                                          
  libyaml.x86_64 0:0.1.4-10.el7                                                 
  lvm2-python-libs.x86_64 7:2.02.105-14.el7                                     
  pyparsing.noarch 0:1.5.6-9.el7                                                
  python-configshell.noarch 1:1.1.fb11-3.el7                                    
  python-ethtool.x86_64 0:0.8-5.el7                                             
  python-kmod.x86_64 0:0.9-4.el7                                                
  python-rtslib.noarch 0:2.1.fb46-1.el7                                         
  python-setproctitle.x86_64 0:1.1.6-5.el7                                      
  python-urwid.x86_64 0:1.1.1-3.el7                                             

Complete!
[root@server1 ~]# 
2. 방화벽 설정에 새로운 서비스를 추가하고, 방화벽을 다시 로드한다.
[root@server1 ~]# firewall-cmd --permanent --add-service=nfs 
success
[root@server1 ~]# firewall-cmd --reload
success
[root@server1 ~]# 
3. NFS관련 서비스들을 시작시에 활성화하고, 시작한다.
[root@server1 ~]# systemctl enable rpcbind nfs-server nfs-lock && systemctl start rpcbind nfs-server nfs-lock
ln -s '/usr/lib/systemd/system/nfs-server.service' '/etc/systemd/system/nfs.target.wants/nfs-server.service'
[root@server1 ~]# 
4. 내보낼 디렉토리(여기서는 /shared라 가정)를 생성한다.
[root@server1 ~]# mkdir /shared
[root@server1 ~]#
5. 전용 그룹(여기서는 /sharedgrp으로 가정한다)을 생성한다.
[root@server1 ~]# groupadd -g 60000 sharedgrp
[root@server1 ~]#
6. 생성한 새 디렉토리에 대해 이전 단계에서 생성한 전용 그룹으로 정의한다.
[root@server1 ~]# chgrp sharedgrp /shared
[root@server1 ~]# 
7. 권한을 정의한다.
[root@server1 ~]# chmod 2770 /shared
[root@server1 ~]# 
8. /etc/exports파일을 열고, 아래 줄을 클라이언트의 이름(또는 ip 주소)와 함께 추가한다.
[root@server1 ~]# vim /etc/exports
/shared server2.example.com(rw,no_root_squash)
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
~                                                                               
-- 끼워넣기 --                                                1,47         모두
[root@server1 ~]#
9. 디렉토리를 내보낸다.
[root@server1 ~]# exportfs -avr
exporting server2.example.com:/shared
[root@server1 ~]# systemctl restart nfs-server
[root@server1 ~]# 
  • 노트1: 클라이언트는 접근 권한을 가진 동일한 그룹(LDAP을 통한)과, 그룹의 구성원이 되어야 한다.
  • 노트2: 마지막 커맨드는 나중에는 필요하지 않다. 재부팅을 하지 않기 위해서 사용하였다.