sudo smbpasswd -a pop , 创建密码,密码为你用户密码
此时 登录 \\192.168.1.4, 可以登陆,但是没有任何目录
修改配置
/etc/samba/smb.conf 中 有6行如下
#Un-comment the following(and tweak the other settings below to suit)#toenable the default home directory shares. This will share each#user's home directory as \\server\username;[homes]; comment = Home Directories
; browseable = no
更改为如下 // 下面的配置只支持 读 ,不支持写#Un-comment the following(and tweak the other settings below to suit)#toenable the default home directory shares. This will share each#user's home directory as \\server\username[homes]
comment = Home Directories
browseable = no
并利用 sudo systemctl restart smbd.service 或者 sudo service smbd restart 重启samba 服务器生效
windows下访问
在windows机器下
在 windows资源管理器 地址栏内输入 \\192.168.1.4// 或 win+R打开运行,输入 \\192.168.1.4
此时会显示一个 文件夹,文件夹名为 pop
双击 pop ,提示你输入账户名和密码
账户名为pop
密码为 你修改后的秘密
进入后,可以看到 /home/pop 下的文件,只能读,不能写
sudo mount -t cifs //192.168.1.4/pop /mnt/ -o username=pop,password=123456
如何查看有哪些samba共享
sudo apt install smbclient
smbtree
centos 7.7 实战
1.[root@localhost ~]# systemctl stop firewalld.service
2.[root@localhost ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.3.[root@localhost ~]# cat /etc/selinux/config
#This file controls the state of SELinux on the system.#SELINUX= can take one of these three values:#enforcing- SELinux security policy is enforced.#permissive- SELinux prints warnings instead of enforcing.#disabled- No SELinux policy is loaded.#SELINUX=enforcing
SELINUX=disabled
#SELINUXTYPE= can take one of three two values:#targeted- Targeted processes are protected,#minimum- Modification of targeted policy. Only selected processes are protected.#mls- Multi Level Security protection.
SELINUXTYPE=targeted
[homes] 下增加
path =/home/pop