Samba 部署
登錄 192.168.200.60 虛擬機,首先修改主機名
[root@lnmp ~]# hostnamectl set-hostname samba
[root@lnmp ~]# bash
[root@samba ~]# hostnamectl
Static hostname: samba
Icon name: computer-vm
Chassis: vm
Machine ID: c4e93637af02487fb22ddc003a2e7bd7
Boot ID: 6c24fdde08ab4e629c7546d7b3c1e2a6
Virtualization: vmware
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.el7.x86_64
Architecture: x86-64
安裝 Samba 服務
[root@samba ~]# yum install -y samba
Loaded plugins: fastestmirror
centos | 3.6 kB 00:00
epel | 4.7 kB 00:00
Loading mirror speeds from cached hostfile
Resolving Dependencies
–> Running transaction check
—> Package samba.x86_64 0:4.6.2-8.el7 will be installed
Complete!
配置 Samba 的組態檔 /etc/samba/smb.conf
[root@samba ~]# vi /etc/samba/smb.conf
1、修改[global]中的內容,找到組態檔中的欄位并修改,添加disable spoolss = yes
load printers = no cups options = raw ;
printcap name = /dev/null
#obtain a list of printers automatically on UNIX System V systems:
; printcap name = lpstat
; printing = bsd
disable spoolss = yes

2、在組態檔的最后 shift+gg
[share]
path = /opt/share 共享路徑
browseable = yes 操作權限
public = yes 訪問權限
writable = yes
對檔案的操作權限
創建目錄并賦予權限
[root@samba ~]# mkdir /opt/share
[root@samba ~]# chmod 777 /opt/share/
啟動 Samba 服務
[root@samba ~]# systemctl start smb
[root@samba ~]# systemctl start nmb
查看埠啟動情況,(netstat 命令若不能用,自行安裝 net-tools 軟體包)
samba的埠為445
[root@samba ~]# yum install -y net-tools
[root@samba ~]# netstat -ntpl

創建 Samba 用戶(這個用戶必須是系統存在的用戶)
[root@samba ~]# smbpasswd -a root
New SMB password:
Retype new SMB password:
Added user root.
重啟 Samba 服務
[root@samba ~]# service smb restart
Redirecting to /bin/systemctl restart smb.service
按“win+R”鍵,并輸入 Samba 服務的 IP 地址,(在使用 PC 訪問 Samba 服務前,確保 Samba 服務器的 SELinux 服務與防火墻服務均處于關閉狀態)
[root@samba ~]# systemctl stop firewalld
[root@samba ~]# setenforce 0

在彈出界面輸入用戶名和密碼,然后單擊右下角的“確定”按鈕(用戶名為 root,密碼 為 000000)


將之前移動到/media 中的 repo 檔案,移動到 share 目錄
[root@samba ~]# mv /media/ /opt/share/*

增加其他用戶訪問
[root@samba ~]# useradd -s /sbin/nologin user001
[root@samba ~]# smbpasswd -a user001
New SMB password:
Retype new SMB password:
Added user user001.
[root@samba ~]# service smb restart 重啟服務
進入 cmd 命令列輸入如下命令清空 samba 登錄記錄

重新訪問

轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/225448.html
標籤:其他
上一篇:UBUNTU-16.04.07和PREEMPT_RT日志
下一篇:ECS阿里云服務器搭建國產GBase 8a MPP Cluster 資料庫集群(解決同地域不同賬號、不同網段的互通問題)
