Manjaro Samba 设置共享文件夹供Windows访问

最近有些资料需要传入到我的老兵(旧笔记本Manjaro)中,使用SamClient并且记录一下

Install:
pacman -S cifs-utils smbclient samba manjaro-settings-samba

set sharefolder:
mkdir /home/share

set permission:
chmod 777 /home/share

create a user for share:
sudo useradd [user]
sudo userdel – r user1 # delete user

edit the config file:
/etc/samba/smb.conf

append setting:

[m_share]
  comment = MSShare Directories
  path = /home/share
  writable = yes
  available = yes
  browseable = yes
  read only = no # read only 属性设置为no 是为了有写入文件权限
  create mask = 0700
  directory mask = 0700

check settings:
testparm

start server:
systemctl enable smb nmb
systemctl start smb nmb

check status:
systemctl status smb

set use and pwd:
gpasswd sambashare -a [user]
smbpasswd -a [user]

[摘录]备份并编辑smb.conf允许网络用户访问

Sudo cp /etc/samba/smb.conf /etc/samba/smb.conf

Sudo gedit /etc/samba/smb.conf

搜索security=user

加入

security = user

username map = /etc/samba/sambausers

文件最后加入:允许访问用户为 user1 贡献目录/home/xxxxx/share

windows 可以直接访问共享文件夹进行CRUD操作,这里有一些坑:

  1. 对于setting配置中 需要设置 security=user

  2. 每次使用需要 start server

  3. 对文件夹设置访问权限,不然不能写入

然后从windows访问samba共享目录,无论使用自己创建的samba用户还是root用户都提示用户名密码错误使用:smbpasswd命令:

smbpasswd -a samba

passwd samba,然后从新登陆成功。

smbpasswd -a 增加用户(要增加的用户必须以是系统用户)

smbpasswd -d 冻结用户,就是这个用户不能在登录了

smbpasswd -e 恢复用户,解冻用户,让冻结的用户可以在使用

smbpasswd -n 把用户的密码设置成空.

使用samba命令输出日志信息: smbd -F -S
目录权限问题应该设置成755: chmod -R 0755 xxxx 有问题 修改为0700

参考自Using Samba in your File Manager(https://wiki.manjaro.org/index.php?title=Using_Samba_in_your_File_Manager#KDE)

原文地址:https://www.cnblogs.com/libbybyron/p/15740026.html