samba安装和简单配置使用

1.安裝

1.1.安裝軟件

yum install samba

1.2.啟動服務

systemctl start smb
systemctl status smb
systemctl enable smb

1.3.創建用戶和目錄

groupadd sales
useradd -g sales sales
passwd sales
mkdir -p /data/samba/sales
chown -R sales.sales /data/samba/sales

1.3.修改配置文件

mv /etc/samba/smb.conf /etc/samba/smb.conf.orig
# 可以看smb.conf.example查看配置文件的選項和含義
vi /etc/samba/smb.conf
###################################################
[global]
        workgroup = sales
        server string = Samba Server Version %v
        netbios name = SalesSamba

        log file = /var/log/samba/log.%m

        security = user

[sales]
        comment = direcotry for sales
        path = /Data/samba/sales
        writable = yes
        valid users = sales
###################################################
testparm
systemctl restart smb
smbpasswd -a sales

2.使用

2.1.Windows

\\xxx.xxx.xxx.xxx\sales

2.2.Linux

# 設置UID和GID後,/mnt目錄的權限就是這個用戶和組
mount -t cifs -o username=sales,password=sales,uid=54321,gid=54322 //xxx.xxx.xxx.xxx/sales /mnt
posted @ 2021-10-27 16:04  monkey6  阅读(337)  评论(0编辑  收藏  举报