1. File preparation: smbd nmbd smbpasswd smb.conf. Obtain the required smb environment and files
a, smb source code: https://download.csdn.net/download/u013301596/87353322
b, smb binary files and configuration files: https://download.csdn.net/download/u013301596/87353318
2. Unzip the samba.zip compressed package, and copy the decompressed directory to the /data/data/ directory of the Android device
3,启动smb服务
export TMPDIR=/data/data/samba/var/tmp/ Set the TMPDIR environment variable
smbd -D starts the samba service,
nmbd -D start samba network service
smbpasswd -a accountname add user/set password
smb.conf file:
[global]
interfaces = wlan0 eth0 lo usb0 br0
workgroup = WORKGROUP
server string = Samba on Android
netbios name = ANDROID
remote announce = 255.255.255.255
encrypt passwords = yes
security = user
restrict anonymous = 1
load printers = no
printcap name = /dev/null
disable spoolss = yes
deadtime = 5
delete readonly = yes
nt acl support = no
inherit permissions = yes
socket options = SO_SNDBUF=16384 SO_RCVBUF=16384
[test]
comment = Android /mnt/sdcard
path = /data/data/samba/var/tmp
force user = root
read only = no
writable = yes
browseable = yes
[sdcard]
vfs objects = fake_perms
comment = Android /mnt/sdcard
path = /mnt/sdcard
force user = root
read only = no
writable = yes
guest ok = no
4. The client accesses the shared directory of the android device:
a, Kernel added: CIFS (Common Internet File System) support
b, Mount the shared directory: mount -t cifs -o username=xxxxxxx, password=xxxxxx //IP/test /mnt