The sudo
command allows you to run commmands or
applications with root privileges. The syntax is the following:
sudo <command>
For example:
[john@localhost john]$ sudo cat /etc/shadow
The command above prints the shadow
file on the
screen, showing the encrypted password of every
user. Normally, a user does not have permissions to view this
file. However, thanks to the sudo
command, the
user john
can view the shadow
file. Notice that the first time you use sudo
you
will be asked to enter your password.
In order to be able to use the sudo
command you
need to add yourself to the list of sudoers. This is
accomplished by editing the file /etc/sudoers
as
root:
[john@localhost john]$ su Password: (enter the root password here) [root@localhost john]# gedit /etc/sudoers
Locate the section User privilege specification, and add the line shown below in bold:
... # User privilege specification root ALL=(ALL) ALL john ALL=(ALL) ALL ...
where instead of "john
" you will type your
user name. After saving the file you will be able to use
sudo
immediately.
gcc
needs special options to compile a device
driver. The compiler should be called as following:
gcc -c -nostdinc -I /usr/src/linux-2.4.20/include/ \ -I /usr/lib/gcc-lib/i386-redhat-linux/3.2/include/ -D MODULE \ -D __KERNEL__ example.c
Each option is explained below:
-c:
compile only, do not
link;-nostdinc:
do not use
the standard include directories;-I dir:
specifies the
include directories;-D MODULE
and
-D __KERNEL__
, define the
MODULE
and __KERNEL__
symbols;