docker samba

时间:2022-11-20 07:04:58

这个就是匿名用户可以登录访问,不能写。

root登录,就可以写了。

#命令,是在物理机上运行的。

主要是根据dockerfile构建镜像。

启动容器

进入镜像

设置root密码。

附smb.conf

[global]
netbios name = easypi
workgroup = WORKGROUP
server string = EasyPi Samba Server
dns proxy = no
log file = /var/log/samba/log.%m
max log size =
syslog =
panic action = /usr/share/samba/panic-action %d
server role = standalone server
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
map to guest = bad user
usershare allow guests = yes
printcap name = /dev/null
load printers = no [homes]
comment = Home Directories
browseable = no
writable = yes [share]
comment = Public File Sharing
path = /share
browseable = yes
read only = no
guest ok = yes
admin users = root
root preexec = mkdir -p /share

如果你想匿名就可以随意写的话,smb.conf如下,docker run 这行执行完,后面的就不用执行了。

[global]
netbios name = Samba
workgroup = WORKGROUP
server string = Samba Server
map to guest = bad user
browsenable = yes
[share]
path = /share
public = yes
writable = yes
create mask =

FROM alpine
MAINTAINER kev <noreply@easypi.pro>

RUN apk add --no-cache samba-common-tools samba-server
COPY ./smb.conf /etc/samba/
VOLUME /etc/samba \
       /var/lib/samba
EXPOSE 137/udp \
       138/udp \
       139/tcp \
       445/tcp
CMD nmbd -D && smbd -FS
#docker build -t test .
#docker run -d -t --restart=always --privileged --name samba -p 445:445 -p 139:139 -p 137:137/udp -p 138:138/udp -v /storage:/share test
#docker exec -it samba sh -l
#smbpasswd -a root  修改root登录samba用的密码,和登录密码不同

/storage 是物理机目录。

/share 是容器目录

ftp配置完,不能用windows映射驱动器,实在没办法给小白用。

还是给小白用sama吧。