Detailed steps to configure samba server

First configure the static IP of the virtual machine,

cd /etc/sysconfig/network-scripts/ifcfg-eno16777736 #z最后的ifcfg是网卡名称。每个人可能都不一样。

1.Install samba service

yum install -y samba

Verify whether the samba service is installed successfully

rpm -qa | grep samba

 3. Modify the samba configuration file (add shared files)

Add the following content at the end of the file (the content marked with arrows can be modified according to your needs)

[share]
        comment=koko
        path=/home/linux/lab
        writable = yes <==可以被所有用户浏览到资源名称,
        browseable = yes <==可以让用户随意登录

 4. Set up an account to log in to the samba server and set a password.

useradd koko
smbpasswd -a xxxxxx

Before creating a samba user, you must first create a system user or use an existing user. The system user has the same name as the samba user, but the password can be set differently.

systemctl restart smb #重启samba服务

The service must be restarted after the configuration file is completed, otherwise it will be invalid.

For the final test, host win+R and enter \\+virtual machine ip address

 Then enter the username and password you set,

Appeared last,

 If there is a problem with the shared directory permissions, add it at the end of the shared directory in the configuration file.

# 新建文件的权限为 664
create mask = 0664
# 新建目录的权限为 775
directory mask = 0775  #权限根据需求更改

Guess you like

Origin blog.csdn.net/m0_74090215/article/details/130673576