我想使用root帐户重新挂载一个只读文件系统,使其成为可读写文件系统。
查看Linux手册页面,我注意到没有像MS_RDWRITE这样的标志,所以我的问题是,有没有人知道网上有一个例子,演示了使用mount with remount标志来设置一个允许读写的只读路径?
对于运行嵌入式Linux的设备,这将在C++中完成。
/* Here's the declared function for Mount a filesystem. */
extern int mount (__const char *__special_file, __const char *__dir,
__const char *__fstype, unsigned long int __rwflag,
__const void *__data) __THROW;发布于 2020-07-12 01:22:39
我无法让原生API正常工作。根据制造商的建议,他们建议在终端窗口中使用remount命令。这对我来说是正确的。
当以root权限调用时,这会将整个根文件夹重新挂载为读写。
// Remount the root folder.
char* cmd = "mount -nwo remount,rw /";
if (-1 == system(cmd))
{
// handle the error.
} https://stackoverflow.com/questions/62557536
复制相似问题