Introduction to Samba overview skip this and start setting up Samba services.
1. Installing Samba
Yum Install-y Samba Samba-client
2. Edit the Samba configuration file
First share a directory, anyone can access, do not need to enter a password, complete an FTP-like anonymous login, but read-only
Vim/etc/samba/smb.conf
Modify MyGroup to workgroup
change Security = user to security = share
Then at the end of the add
[Test] #可以随意定义
comment = share all
Path =/tmp/sambadir
browseable = yes
Public = yes
writable = no
: X
Save exit
3. Start Samba Services
/ETC/INIT.D/SMB start
4. Create a shared directory
Mkdir/tmp/sambadir
Cp/etc/passwd/tmp/sambadir/test.txt
Mkdir/tmp/sambadir/test
chmod 777!$
5. Clear Iptables
Iptables-f
6. Under Windows press Win+r enter \ \ virtual machine IP address return to view
7. Enter Smbclient//ip/shared directory under Linux
You can view the shared directory prompt to enter a password without having to go directly to it
ls to view
Q Exit directly
You can also view it in a mounted way
Yum Install-y cifs-utils
MOUNT-T//ip/shared directory requires a directory to mount, such as/opt
Df-h can view
Share a directory, log in with a user name and password, require readable writable
Vim/etc/samba/smb.conf
Drop or delete the last comment
[Test] #可以随意定义
Comment = Share all
Path =/tmp/sambadir
browseable = yes
Public = yes
writable = no
change Security = share to security = user
Finally added
[Demo]
comment = Share for users
Path =/tmp/sambadir
browseable = yes
Writable=yes
Public =no
: Wq
Add a test user
Useradd Share
Pdbedit-a Share
Then set the password
You can also view help via Pdbedit-h
Then restart the Samba service
View in Linux with Smbclient
Smbclient//ip/shared directory-U shared user
Enter password
[Email protected] opt]# smbclient//192.168.1.105/demo-ushare
Enter share ' s password:
Domain=[workgroup] Os=[unix] Server=[samba 3.6.23-30.el6_7]
SMB: \> ls
. D 0 Wed May 11 14:56:24 2016
.. D 0 Wed May 11 14:55:47 2016
Test D 0 Wed May 11 14:56:24 2016
passwd 1294 Wed May 11 14:56:13 2016
35831 blocks of size 524288. 28838 blocks Available
SMB: \> Q
can also be mounted via mount
MOUNT-T//ip/shared directory requires a directory to mount, such as/mnt-o username=share,password=123
The samba chapter on deployment and optimization of common Linux services