当前位置:网站首页>03_ Detailed explanation and test of installation and configuration of Ubuntu Samba

03_ Detailed explanation and test of installation and configuration of Ubuntu Samba

2020-11-06 01:14:52 Polaris 6

03_ubuntu samba Installation configuration

  1. install samba
sudo apt install samba
  1. modify samba The configuration file
sudo vim /etc/samba/smb.conf
[share]
	comment = Share to windows
	path = /home/liuj/
	create mask = 0664
	directory mask = 0664
	valid users = liuj
	force user = liuj
	force group = liuj
	available = yes
	browseable = yes
	public = yes
	writable = yes

analysis :

create mask = 0664 # The default created file permissions are 0664, That is, ordinary user rights ; If you often pass through samba modify shell Script , It can be changed to 0764
directory mask = 0664
valid users = liuj # Created samba user
force user = liuj # System user:group
force group = liuj # That is, through samba user, adopt samba After modifying the file, the attribute is chown liuj:liuj

  1. restart samba service
sudo /etc/init.d/smbd restart
  1. establish samba account number
sudo touch /etc/samba/smbpasswd
sudo smbpasswd -a liuj		# establish username by  liuj  account number 
New SMB password: xxxx		# Input password 
Retype new SMB password: xxxx	# Confirm the password 
  1. window Next verification test
\\xxx.xxx.xxx.xxx  -->  Enter the account and password 
\\192.168.0.55
user: liuj
pass: test123
  1. linux Users who don't exist on the system Such as user.name=demo
sudo smbpasswd -a demo
New SMB password:ij2200862
Retype new SMB password:ij2200862
Failed to add entry for user demo.

 Add the corresponding group of the system 
groupadd demo -g 6000
useradd demo -u 6000 -g 6000 -s /usr/sbin/nologin -d /dev/null

2.linux On smbclient test

  1. Show samba Partition
 command : smbclient -L host_ip -U user/pass
 example :
smbclient -L 192.168.56.104 -U liuj%test123
WARNING: The "syslog" option is deprecated
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.3.11-Ubuntu]

Sharename Type Comment
--------- ---- -------
liuj Disk Share to windows
IPC$ IPC IPC Service (shz-xxxxxxx vl server (Samba, Ubuntu))
  1. samba visit
 command : smbclient //host_ip/share -U user/pass
 example :
smbclient //192.168.56.104/liuj -U  liuj%test123
WARNING: The "syslog" option is deprecated
Domain=[WORKGROUP] OS=[Windows 6.1] Server=[Samba 4.3.11-Ubuntu]
smb: \> ls

版权声明
本文为[Polaris 6]所创,转载请带上原文链接,感谢