//创建目录与共享目录名下的path对应,如果没有shared前面的目录不存在,先创建,如果存在不会提示
[root@localhost samba]# service smb restart //重启smb服务,让配置生效
开始—运行或(win+R)在打开输入linux的IP地址:\\\\172.19.22.85,然后按确定
可以看到myshare、public共享目录及打印机和传真共享
在目录中创建word文件不允许创建
[root@localhost samba]# ls -ld /usr/somewhere/else/public/
//因为window访问属于其它用户,从显示的详细的文件信息中看出,其它用户只有执行的权限,其它用户对目录没有读写的权限
drwxr-xr-x 2 root root 4096 4月 12 22:19 /usr/somewhere/else/public/ [root@localhost samba]# chmod o+rw /usr/smewhere/else/public/ //设置其它用户的权限,其它用户可以读写
//关掉窗口在重新打开,可以对目录进行读写操作了
如果访问myshare是不允许访问的,安全级别不是share不能访问。
[root@localhost samba]# useradd mary //创建mary用户
[root@localhost samba]# useradd fred //创建fred用户
[root@localhost samba]# smbpasswd -a mary
//设置smb用户mary的密码,可以用smbpasswd +用户,进行修改密码,加选项参数-d:删除用户权限,无法访问。-x:删除用户。-e:使用户重新恢复权限。-m:加成信任主机账户 New SMB password: Retype new SMB password: unable to open passdb database. Added user mary.
[root@localhost samba]# smbpasswd -a fred //设置smb用户fred的密码 New SMB password: Retype new SMB password: Added user fred. [root@localhost samba]#
[root@localhost samba]# grep mary /etc/passwd
//查看mary用户密码,如果将:x:中的x去掉,该用户就不要用密码,就可以登录了。 mary:x:501:501::/home/mary:/bin/bash [root@localhost samba]# grep fred /etc/passwd fred:x:502:502::/home/fred:/bin/bash
[root@localhost samba]# more /etc/samba/smbpasswd //smb用户的密码被加密保存在/etc/samba/smbpasswd文件中
将Security=share的级别修改为security = user,然后重启smb服务
在访问就会弹出一个连接到172.19.22.85的对话框,要求输入用户及密码