安装samba-common、samba、samba-client:
[root@localhost Desktop]# yum install samba-common
、、、
Complete!
[root@localhost Desktop]# yum install samba
、、、
Complete!
[root@localhost Desktop]# yum install samba-client
、、、
Complete!
当Samba服务器的安全级别为用户时,用户访问Samba服务器时必须提供该用户名和密码,而只有Linux系统本身的用户才能成为Samba用户,并需设置其Samba密码。所以接下来要创建新的系统用户名和密码,并另之成为Samba用户。
设置系统用户名和密码:
[root@localhost ~]# cd /home
[root@localhost home]# useradd sambtext
[root@localhost home]# passwd
Changing password for user root.
New password: //设置密码123456,此处密码输入屏幕不会显示输入
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
设置Samba用户名和密码:
[root@localhost home]# smbpasswd -a sambtext
New SMB password: //设置密码123456,此处密码输入屏幕不会显示输入
Retype new SMB password:
Added user sambtext.
新建好的用户文件夹放在/home目录下:
[root@localhost home]# ls
hhh sambtext
在sambtext目录下创建要分享的文件夹sharedoc:
[root@localhost home]# cd sambtext/
[root@localhost sambtext]# mkdir sharedoc
[root@localhost sambtext]# ll
total 4
drwxr-xr-x. 2 root root 4096 Jun 25 03:58 sharedoc
进入配置文件:
[root@localhost sambtext]# cd /etc/samba/
[root@localhost samba]# ls
lmhosts sharedoc smb.conf smbusers
[root@localhost samba]# vim smb.conf
这里如果是user,则访问Samba服务器需要账户密码;如果是share,则不需要密码:
共享模式(share):
Backend to store user information in. New installations should
use either tdbsam or ldapsam. smbpasswd is available for backwards
compatibility. tdbsam requires no further configuration.
security = share
passdb backend = tdbsam
----------------------- Domain Members Options ------------------------
删除注释: