在Linux后台开发过程中经常是Windows下编写代码,然后将代码拷贝到Linux虚拟机下进行编译,为了避免拷贝操作,通过samba共享目录方式,步骤如下:
1、安装samba
yum install samba samba-client
2、添加共享目录vi /etc/samba/smb.conf
workgroup = WORKGROUP
[share]
path = /root/home/code
writable=yes
browseable = yes
public = yes
writable = yes
3、重启smb服务
systemctl restart smb
4、修改目录权限
chmod -R 777 /root/home/code
5、关闭防火墙
systemctl stop firewalld
6、添加用户名
smbpasswd -a root
mahongbo
7、关闭SELINUX
临时:setenforce 0
永久:/etc/selinux/config修改SELINUX=disabled
8、访问共享目录
\192.168.24.200\share
虚拟机/root/home/code/mytest
9、设置开机启动:systemctl enable smb.service