Skip to content

Commit be16ad6

Browse files
committed
Add sudo for file access permissions
Add sudo to commands in Chapter 8 for example module interaction. The "myvariables" in the module are set with 0660 permissions via __ATTR(), preventing direct user access. Options to fix this: 1. Instruct users to use 'sudo' to read/write files. 2. Relax the permission settings to 0666. This commit adopts the sudo method to maintain security constraints.
1 parent 1d3943a commit be16ad6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lkmpg.tex

+3-3
Original file line numberDiff line numberDiff line change
@@ -1347,14 +1347,14 @@ \section{sysfs: Interacting with your module}
13471347
What is the current value of \cpp|myvariable| ?
13481348

13491349
\begin{codebash}
1350-
cat /sys/kernel/mymodule/myvariable
1350+
sudo cat /sys/kernel/mymodule/myvariable
13511351
\end{codebash}
13521352

13531353
Set the value of \cpp|myvariable| and check that it changed.
13541354

13551355
\begin{codebash}
1356-
echo "32" > /sys/kernel/mymodule/myvariable
1357-
cat /sys/kernel/mymodule/myvariable
1356+
echo "32" | sudo tee /sys/kernel/mymodule/myvariable
1357+
sudo cat /sys/kernel/mymodule/myvariable
13581358
\end{codebash}
13591359

13601360
Finally, remove the test module:

0 commit comments

Comments
 (0)