荆轲刺秦王

虚拟机:VMware Workstation Pro

系统:CentOS 7

配置本地环境时,每次重启虚拟机,共享文件夹就失效,一开始我是每次重启后都将共享文件夹关闭后再开启,这样也能使共享文件夹生效,缺点就是太麻烦

于是找到解决方案如下:

vim /etc/rc.local

在最后一行加入:

vmhgfs-fuse .host:/ /mnt/hgfs
//如果需要普通用户也能使用共享目录,则需使用下面的命令挂载
vmhgfs-fuse -o allow_other .host:/ /mnt/hgfs

我的 rc.local 文件内容:

#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
ulimit -n 65535
service nginx start

vmhgfs-fuse -o allow_other .host:/ /mnt/hgfs

 

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐