Is it possible to overwrite the file /proc/sys/dev/cdrom/info?
Environment
- Red Hat Enterprise Linux
Issue
- Is it possible to overwrite the file /proc/sys/dev/cdrom/info?
Resolution
From source, it is seen that .mode is set as 0444.
.ctl_name = DEV_CDROM_INFO,
.procname = "info",
.data = &cdrom_sysctl_settings.info,
.maxlen = CDROM_STR_SIZE,
.mode = 0444,
.proc_handler = &cdrom_sysctl_info,
This means that the file does not have write permissions unlike other files in the same directory.
# ll /proc/sys/dev/cdrom/
total 0
-rw-r--r-- 1 root root 0 Sep 13 06:29 autoclose
-rw-r--r-- 1 root root 0 Sep 13 06:29 autoeject
-rw-r--r-- 1 root root 0 Sep 13 06:29 check_media
-rw-r--r-- 1 root root 0 Sep 13 06:29 debug
-r--r--r-- 1 root root 0 Sep 13 06:29 info <-------------
-rw-r--r-- 1 root root 0 Sep 13 06:29 lock
So it is not possible to write or overwrite the file.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.