1. Trang chủ
  2. » Công Nghệ Thông Tin

Topic 11 File Sharing

8 5 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Triển khai một máy tính làm việc Linux với các tính năng về đồ họa, vi tính văn phòng,… Hệ thống vận hành: cài đặt, cấu hình, quản trị, xử lý sự cố,… Vận hành hệ điều hành Linux: cài đặt, cấu hình mạng, máy trong, sử dụng thành thạo các công cụ quản lý mạng, cấu hình nhân, DFS, lập kế hoạch cho việc lưu trữ và phục hồi dữ liệu, TCP IP , config device,… Liên kết cơ bản kỹ năng đến Internet: kết nối, email, bảo mật, DNS, Apache, SSH, NTP,…

Topic 11: File Sharing NFS Server Configuration Samba Server Configuration NFS Server Configuration NFS: dịch vụ chia sẻ file máy linux Cài đặt NFS NFS dịch vụ hỗ trợ chế chia sẻ tài nguyên máy chủ Linux - Kiểm tra NFS cài đặt hay chưa: [root@localhost ~]# rpm -qa | grep nfs libnfsidmap-0.25-17.el7.x86_64 nfs4-acl-tools-0.3.3-15.el7.x86_64 nfs-utils-1.3.0-0.48.el7.x86_64 Ngồi NFS cịn đỏi hỏi phải có Daemon quan trọng dùng để quản lý kết nối rpcbind Mặc định rpcbind cài đặt sẵn hệ thống rpcbind listen TCP port 111 - Kiểm tra rpcbindđã cài đặt hệ thống: [root@localhost Desktop]# rpm -qa rpcbind rpcbind-0.2.0-26.el7.x86_64 Cấu hình NFS server # vi /etc/idmapd.conf Domain = nhatnghe.com file dùng để cấu hình NFS /etc/exports - Tạo thư mục chia sẻ sau: [root@may1 ~]# mkdir -p /data/{software,dulieu,database} [root@may1 ~]# cp -rv /etc/* /data/dulieu/ - Cấp quyền truy cập vào thư mục /share: [root@may1 ~]# chmod 777 /data/dulieu/ [root@may1 ~]# chmod 777 /data/database/ - Sửa file /etc/exports thêm vào dòng sau: /data/software *(ro,sync) /data/dulieu 192.168.1.0/24(rw,sync) /data/database 192.168.1.100/32(rw,sync) NFS Gồm có quyền truy cập thơng dụng sau: secure : Port từ client requests phải nhỏ 1024 ro : Read only rw : Read – write noaccess : Denied access root_squash : Ngăn remote root users no_root_squash : Cho phép remote root users - Khởi động dich vụ: # systemctl restart rpcbind # systemctl start nfs-server #systemctl start nfs-lock #systemctl start nfs-idmap 154 Phiên Bản Thử Nghiệm – Lưu Hành Nội Bộ # systemctl enable rpcbind # systemctl enable nfs-server # systemctl enable nfs-lock # systemctl enable nfs-idmap - Kiểm tra rpcbind daemon: [root@may1 ~]# netstat -nltp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address tcp 0 0.0.0.0:111 0.0.0.0:* tcp 0 0.0.0.0:22 0.0.0.0:* State LISTEN LISTEN PID/Program name 1471/rpcbind 8502/sshd Lưu ý: sau thay đổi file /etc/exports bạn phải restart daemon nfs hay dùng lệnh sau: exportfs -a : Reload lại tồn cấu hình cho NFS exportfs -r : Reload lại thay đổi cấu hình cho NFS - Do NFS cần mở số port chạy (111, 2049 ) nên ta cần cấu hình firewall mở port hay tắt firewall: - Kiểm tra nfs quản trị rpcinfo [root@may1 ~]# rpcin 100000 tcp6 100000 tcp6 100000 udp6 100000 udp6 100000 tcp 100000 tcp 100000 tcp 100000 udp o ::.0.111 ::.0.111 ::.0.111 ::.0.111 0.0.0.0.0.111 0.0.0.0.0.111 0.0.0.0.0.111 0.0.0.0.0.111 portmapper superuser portmapper superuser portmapper superuser portmapper superuser portmapper superuser portmapper superuser portmapper superuser portmapper superuser Cấu hình NFS client: 3.1 Cấu hình truy cập tay - Tạo thư mục: [root@localhost ~]# mkdir -p /server/{software,dulieu,database} - Mount NFS file: [root@localhost ~]# mount -t nfs 192.168.1.101:/data/software /server/software [root@localhost ~]# mount -t nfs 192.168.1.101:/data/dulieu /server/dulieu [root@localhost ~]# mount -t nfs 192.168.1.101:/data/database /server/database - Kiểm tra mount point hệ thống: - Kiểm tra: 3.2 Cấu hình truy cập file /etc/fstab - Sửa file /etc/fstab sau: [root@localhost ~]# vi /etc/fstab [root@localhost ~]# vi /etc/fstab tmpfs defaults 00 tmpfs /dev/shm devpts /dev/pts devpts gid=5,mode=620 0 sysfs /sys sysfs defaults 00 proc /proc proc defaults 00 192.168.1.101:/data/software /server/software nfs soft,nfsvers=2 0 192.168.1.101:/data/dulieu /server/dulieu nfs soft,nfsvers=2 0 192.168.1.101:/data/database /server/database nfs soft,nfsvers=2 0 - Reboot lại hệ thống: init - mount, kiểm tra mount point tạo ý: sử dụng lệnh man nfsstat để xem thêm option lênh nfsstat - Liệt kê danh sách portmapper đăng ký host [root@may1 ~]# rpcinfo -p localhost program vers proto port service 100000 tcp 111 portmapper 100000 tcp 111 portmapper 100000 tcp 111 portmapper 100000 udp 111 portmapper 100000 udp 111 portmapper 100000 udp 111 portmapper 100024 udp 34563 status 100024 tcp 41552 status 156 Phiên Bản Thử Nghiệm – Lưu Hành Nội Bộ Samba server Cài đặt samba: Là dịch vụ hỗ trợ chia sẻ tài nguyên từ hệ thống Linux với hệ thống khác Linux, Windows - Kiểm tra samba cài đặt hay chưa: # rpm -qa | grep samba samba-common-4.1.12-21.el7_1.x86_64 samba-4.1.12-21.el7_1.x86_64 samba-client-4.1.12-21.el7_1.x86_64 samba-libs-4.1.12-21.el7_1.x86_64 Cấu hình samba server - Tạo thư mục chia sẻ sau: [root@may1 ~]# mkdir -p /nhatnghe/{giaovien,hocsinh,baithi,software} [root@may1 ~]# chmod 777 /nhatnghe/giaovien/ [root@may1 ~]# chmod 777 /nhatnghe/hocsinh [root@may1 ~]# chmod 777 /nhatnghe/baithi [root@may1 ~]# - Sửa file /etc/samba/smb.conf sửa dòng sau: [root@may1 ~]# vi /etc/samba/smb.conf Thêm dòng 66 unix charset = UTF-8 Sửa dòng: 89 workgroup = WORKGROUP 124 passdb backend = smbpasswd - Tạo user truy cập [root@may1 ~]# groupadd giaovien [root@may1 ~]# groupadd hocsinh [root@may1 ~]# useradd -G giaovien gv1 [root@may1 ~]# useradd -G giaovien gv2 [root@may1 ~]# useradd -G hocsinh hs1 [root@may1 ~]# useradd -G hocsinh hs2 - Tạo mật cho người dùng samba [root@may1 ~]# smbpasswd -a gv1 [root@may1 ~]# smbpasswd -a gv2 [root@may1 ~]# smbpasswd -a hs1 [root@may1 ~]# smbpasswd -a hs2 - Start daemon smb: [root@localhost Desktop]# systemctl start smb [root@localhost Desktop]# systemctl start nmb [root@localhost Desktop]# systemctl enable smb ln -s '/usr/lib/systemd/system/smb.service' '/etc/systemd/system/multiuser.target.wants/smb.service' [root@localhost Desktop]# systemctl enable nmb ln -s '/usr/lib/systemd/system/nmb.service' '/etc/systemd/system/multiuser.target.wants/nmb.service' - Do samba cần mở số port chạy (139,445, ) nên ta cần cấu hình firewall mở port hay tắt firewall: Cấu hình samba client 3.1 Trên Windows Vào Start menu -> chọn Run: \\192.168.1.101 Nhập user hs1, password: 123 3.2 Trên Linux - Tạo thư mục: [root@localhost ~]# mkdir /giaovien/ - Mount smb file: [root@localhost ~]# mount -o username=gv1,password=123 //192.168.1.20/gv1 /giaovien Share tài nguyên file [global] workgroup = MYGROUP server string = Samba Server Version %v passdb backend = smbpasswd log file = /var/log/samba/log.%m max log size = 50 create mask = 0766 directory mask = 0777 cups options = raw [homes] 158 Phiên Bản Thử Nghiệm – Lưu Hành Nội Bộ comment = Home Directories read only = No browseable = No [printers] comment = All Printers path = /var/spool/samba printable = Yes browseable = No # Tạo share hocsinh: user đọc, ghi [Hocsinh] comment = Du lieu dung chung path = /nhatnghe/hocsinh read only = No # Tạo share Baithi: nhóm giaovien đọc, ghi, nhóm hocsinh đọc [Baithi] comment = Bai thi hoc ky path = /nhatnghe/baithi valid users = +hocsinh, +giaovien write list = +giaovien # Tạo share Giaovien, gv1 tạo, gv2 xem [Giaovien] comment = Bai thi hoc ky path = /nhatnghe/giaovien valid users = +giaovien write list = +giaovien create mask = 0760 directory mask = 0770 # Tạo share Software user đọc [Software] comment = Phan mem co ban path = /nhatnghe/software # Tạo share ẩn bgh có user ht truy cập [bgh] comment = Ban giam hieu path = /nhatnghe/bgh valid users = ht read only = No browseable = No Tại client thử truy cập: \\192.168.1.101 160 Phiên Bản Thử Nghiệm – Lưu Hành Nội Bộ ... udp6 100000 tcp 100000 tcp 100000 tcp 100000 udp o ::.0 .111 ::.0 .111 ::.0 .111 ::.0 .111 0.0.0.0.0 .111 0.0.0.0.0 .111 0.0.0.0.0 .111 0.0.0.0.0 .111 portmapper superuser portmapper superuser portmapper... proto port service 100000 tcp 111 portmapper 100000 tcp 111 portmapper 100000 tcp 111 portmapper 100000 udp 111 portmapper 100000 udp 111 portmapper 100000 udp 111 portmapper 100024 udp 34563... TCP port 111 - Kiểm tra rpcbindđã cài đặt hệ thống: [root@localhost Desktop]# rpm -qa rpcbind rpcbind-0.2.0-26.el7.x86_64 Cấu hình NFS server # vi /etc/idmapd.conf Domain = nhatnghe.com file dùng

Ngày đăng: 27/09/2022, 02:35

Xem thêm:

HÌNH ẢNH LIÊN QUAN

exportfs -r : Reload lại những thay đổi trong cấu hình cho NFS - Topic 11 File Sharing
exportfs r : Reload lại những thay đổi trong cấu hình cho NFS (Trang 3)
3.2. Cấu hình truy cập trong file /etc/fstab - Topic 11 File Sharing
3.2. Cấu hình truy cập trong file /etc/fstab (Trang 4)
3. Cấu hình samba client - Topic 11 File Sharing
3. Cấu hình samba client (Trang 6)
- Do samba cần mở một số port khi chạy như (139,445,..) nên ta cần cấu hình firewall mở các port này hay tắt firewall:  - Topic 11 File Sharing
o samba cần mở một số port khi chạy như (139,445,..) nên ta cần cấu hình firewall mở các port này hay tắt firewall: (Trang 6)
w