centos 系统samba配置

自己去安装,省略。
#yum -y install samba samba-client # cd /etc/samba/
#cp smb.conf smb.conf.bak

[root@www-v2 samba]# vim smb.conf

# A publicly accessible directory, but read only, except for people in
# the “staff” group
[public]
comment = Public Stuff
#path = /home/samba
path = /home/www/work (centos需要被共享的目录)
public = yes
writable = yes
printable = no
write list = +staff

配置samba用户

#smbpasswd -a root
注:a = add

此时设置的密码是windows访问此目录时要输入的密码

设置完用户之后重启samba:
[root@www-v2 samba]# /etc/init.d/smb restart
关闭 SMB 服务: [确定]
启动 SMB 服务:
或者 [确定]

service smb restart

#chown nobody:nobody /home/www/work

//将目录变更为nobody用户和nobody组,由于在/etc/samba/smbuser文件中有guest=nobody一项,即nobody等价于guest账户

在“我的电脑”中打开“计算机”,在地址栏中输入:192.168.159.128此为我的虚拟机的IP,也是samba服务器的IP

之后会提示你输入用户名和密码

如果配置SAMBA用户时只是配置了root用户的话,则以root用户登录,即用户名为root,密码为配置samba用户时设置的密码
然后在windows系统192.168.0.135 这个IP是 centos系统的IP。
即可出现共享的public目录。点击进去就是

/home/www/work。请先关闭linux的selinux和防火墙。

在centos测试
[root@localhost work]# smbclient -L 127.0.0.1 -U root
Enter SAMBA
oot’s password:
Domain=[LOCALHOST] OS=[Windows 6.1] Server=[Samba 4.6.2]

Sharename Type Comment
——— —- ——-
print$ Disk Printer Drivers
public Disk Public Stuff
IPC$ IPC IPC Service (Samba 4.6.2)
root Disk Home Directories
Domain=[LOCALHOST] OS=[Windows 6.1] Server=[Samba 4.6.2]

Server Comment
——— ——-

Workgroup Master
——— ——-

© 版权声明
THE END
如果内容对您有所帮助,就支持一下吧!
点赞0 分享
评论 共1条

请登录后发表评论