首页 > 代码库 > samba 搭建

samba 搭建

#useradd -M -s /sbin/nologin kvmshare

#mkdir /home/etl

#chown kvmshare:kvmshare /home/etl

将本地账号添加到 samba 密码 xxx

#smbpasswd -a kvmshare
New SMB password:
Retype new SMB password:
Added user kvmshare.

修改配置如下 /etc/samba/smb.conf

[global]
    server string = Samba Server Version %v
    interfaces = lo br*
    bind interfaces only = Yes
    security = USER
    log file = /var/log/samba/log.%m
    max log size = 50
    load printers = No
    printcap name = /dev/null
    idmap config * : backend = tdb
    hosts allow = 127. 172.18.
    printing = bsd
[kvm]
    comment = KVM User read write
    path = /home/etl
    public = yes
    writeable = yes
    valid users = kvmshare

#service smb start

#systemctl enable smb.service                                            加入开机自启samba服务
#service smb status                                                             开看samba服务是否启动
#ll /etc/systemd/system/multi-user.target.wants/                 查看samba服务是否正常加入自启
# pdbedit -L                      查看samba用户
 
使用 smbclient 连接测试:
# smbclient //localhost/kvm -U kvmshare
Enter kvmshare‘s password:
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.2.10]
smb: \> ls
 
 
 

 

samba 搭建