1、银河麒麟桌面V10(SP1) linux 5.4.18-23-generic #9b1-KYLINOS ---也是ubuntu?
查看运行类型
runlevel
返回N 5 <---图形界面, 对应启动/etc/rc5.d下S??程序
建立服务脚本vm-share-file.sh
sudo vim /etc/init.d/vm-share-file.sh
内容
!/bin/sh -e
vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
exit 0
保存退出 :wq
增加执行权限:
sudo chmod 777 /etc/init.d/vm-share-file.sh
链接到rc5.d
sudo ln -s /etc/init.d/vm-share-file.sh /etc/rc5.d/S99vm-share-file
重新启动
reboot
完成
2、优麒麟20.04 Linux 5.10.0-1027-oem #28-Ubuntu
在1、银河麒麟桌面最后链接文件编号改成S95,重新启动前增加下面操作:
cd /etc/init.d
sudo update-rc.d vm-share-file.sh defaults 95
然后重新启动
完成
3、深度deepin linux 5.10.18-amd64-desktop #1
cd /etc/init.d
建立服务脚本vmthis-share-file.sh,在/etc/init.d下已经有vm-share-file.sh,所以改了个文件名。
sudo vim /etc/init.d/vmthis-share-file.sh
内容:第二行起的15行内容是为了避免报 warning: script missing LSB tags ... 错误
#!/bin/sh
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $portmap
# Should-Stop: $portmap
# X-Start-Before: nis
# X-Stop-After: nis
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO
vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
exit 0
保存退出 :wq
增加执行权限:
sudo chmod 777 /etc/init.d/vmthis-share-file.sh
设置rc5.d启动顺序
sudo update-rc.d vmthis-share-file.sh defaults 95
链接到rc5.d
sudo ln -s /etc/init.d/vmthis-share-file.sh /etc/rc5.d/S95vmthis-share-file
重新启动
sudo reboot
4、统信unionTech OS, linux 5.4.50-amd64-desktop #3000
统信执行sudo需要进入开发者模式。
点击“控制中心”--拉到最下方点击“通用”--点击右侧第二项“开发者模式”--输入手机号,选择验证码登录即可注册、登录,登录后点击“激活”,然后重启系统,进入终端
cd /etc/init.d
建立服务脚本vm-share-file.sh
sudo vim /etc/init.d/vm-share-file.sh
内容:
#!/bin/sh -e
vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
exit 0
保存退出 :wq
增加执行权限:
sudo chmod 777 /etc/init.d/vm-share-file.sh
链接到rc5.d
sudo ln -s /etc/init.d/vm-share-file.sh /etc/rc5.d/S05vm-share-file
注意文件名编号S05
重新启动
reboot
完成
5、普华服务器86 Linux 4.18.0-147.5.1.el8.x86_64 #1
cd /etc/init.d
建立服务脚本vm-share-file.sh
sudo vim /etc/init.d/vm-share-file.sh
内容:
#!/bin/sh -e
vmhgfs-fuse .host:/ /mnt/hgfs -o subtype=vmhgfs-fuse,allow_other
exit 0
保存退出 :wq
增加执行权限:
sudo chmod 777 /etc/init.d/vm-share-file.sh
链接到rc5.d
sudo ln -s /etc/init.d/vm-share-file.sh /etc/rc5.d/S01vm-share-file
注意文件名编号S01
重新启动
reboot
完成
参考:
1、安装VMWare tools,以及解决安装后/mnt中有hgfs但没共享文件的方法 https://www.cnblogs.com/jiu0821/p/5946062.html
2、中标麒麟虚拟机与windows系统共享文件夹 https://blog.csdn.net/weixin_42121713/article/details/106563346
3、VMware-tools安装以及找不到共享文件夹的解决办法 https://blog.csdn.net/BjarneCpp/article/details/95899425
4、Ubuntu下添加开机启动项的2种方法 https://www.jb51.net/os/Ubuntu/181138.html
5、
Solving the error “insserv: warning: script ‘script’ missing LSB tags and overrides” https://ixnfo.com/en/solving-the-error-insserv-warning-script-script-missing-lsb-tags-and-overrides.html