[英]Create a read-only file in yocto
How do I create a read-only file in yocto. 如何在yocto中创建只读文件。
I have given only read permissions to all groups in the bbappend file 我仅对bbappend文件中的所有组授予读取权限
do_install_append() {
install -m 0444 os-release ${D}${sysconfdir}/
}
ls -al /etc/os-release correctly list the permissions, but I am able to modify the file in root user. ls -al / etc / os-release正确列出了权限,但是我可以在root用户中修改文件。
How can I avoid this behavior and make it read-only 如何避免这种行为并将其设置为只读
I tested this on ubuntu 18.04: 我在ubuntu 18.04上进行了测试:
erni@Sally:~$ date >> test.txt
erni@Sally:~$ echo test >> test.txt
erni@Sally:~$ chmod 444 test.txt
erni@Sally:~$ echo test2 >> test.txt
bash: test.txt: Permission denied
erni@Sally:~$ sudo sh -c 'echo test3 >> test.txt'
erni@Sally:~$ cat test.txt
gio 6 dic 2018, 17.28.42, CET
test
test3
As you can see you can still modify a protected file in ubuntu 如您所见,您仍然可以在ubuntu中修改受保护的文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.