Install with yum
1. Install samba
yum install samba |
One command to install
2. Modify the samba configuration file , back up the original, and create a new configuration file
cd /etc/samba mv smb.conf smb.confbak touch smb.conf |
3. Write smb.conf
[global] workgroup=longcredit.com netbios name=WAS server string=WebSphere Server security=share
[sofa_home] ( this is the directory displayed by the remote share ) path=/opt/sofa_home writeable=yes browseable=yes guest ok=yes |
The [global] section is the global configuration and must be written. Among them are the following lines;
workgroup is the workgroup displayed in Windows ; here I set LINUXSIR (in uppercase);
netbios name is the computer name displayed in Windows ;
The server string is the description of the Samba server, which can be defined by yourself; this is not important;
security is the verification and login method, here we use share ; there are many verification methods, this is one of them; the other commonly used verification method is user ; if share is used, there is no need to set user and password;
[sofa_home] This is a shared directory displayed in Windows ;
path = can set where the directory to be shared is placed;
Whether writeable is writable, here I set it to be writable;
Whether browseable can be browsed, yes; browseable means that we can see the shared folder under the workgroup. If you don't want to show it, set browseable=no
The guest ok anonymous user is logged in as a guest ;
4. Create a corresponding directory and authorize
mkdir -p /opt/sofa_home
|
The following is to solve the problem that shared things can be read but not written
Modify /etc/sysconfig/selinux to change enforcing to disabled ; then the command line setenforce 0;
chmod -R 777 /opt/sofa_home
5. Start the service
service samba start |