xww5
deepin
2022-07-08 02:42 
1、新建/etc/rc.local 文件。
sudo dedit /etc/rc.local
2、粘贴以下模板:
#!/bin/sh -e
rc.local
This script is executed at the end of each multiuser runlevel.
Make sure that the script will "exit 0" on success or any other
value on error.
In order to enable or disable this script just change the execution
bits.
By default this script does nothing.
exit 0
3、在exit 0 上方插入你需要自启的命令(一行一个)后保存文件,我所需要追加的命令是:
mount -t cifs -o username=xx,password=xxx,dir_mode=0777,file_mode=0777 //192.168.0.1/D /Software/D
(注意:两个0777是给你挂载的文件夹有读写权限,毕竟是共享盘嘛)
代码如下:
#!/bin/sh -e
rc.local
This script is executed at the end of each multiuser runlevel.
Make sure that the script will "exit 0" on success or any other
value on error.
In order to enable or disable this script just change the execution
bits.
By default this script does nothing.
mount -t cifs -o username=xx,password=xxx,dir_mode=0777,file_mode=0777 //192.168.0.1/D /Software/D
exit 0
4、给你编写的脚本加上777权限:
sudo chmod +755 /etc/rc.local
5、可以调试一下自己的脚本是否成功:
sudo /etc/rc.local
Reply Like 0 View the author


中文 

Deepin用sudo mount -t cifs -o挂载共享文件夹以后,挂载也成功了。但是重启电脑以后,又得重新挂载,能否有办法,让挂载成功以后,就一直挂载着。向windows设置挂载好了以后,开机以后自动识别。