Linux System Administration – Part 3

How to monitor the loaded kernel modules

A Linux system administrator may be required to watching the loaded kernel modules. The command that help to achieve this is “lsmod”.

Example :

Another way to list all currently loaded kernel modules is to use “cat /proc/modules”.

Example :

Getting information about files

The “ls -la” command usually provides the access informaion about files and directories. Also the “fuser” command is used for identifying processes using files or sockets.

Example :

In order to modify the file access permissions, use the command “chmod”. To change file ownership, use command “chown”.

Example : To change the file permissions of the file “testfile” to have the following permissions, use “chmod 775 testfile”

Permissions Read Write Execute  Final Value to use
Owner Yes – 1 Yes – 1 Yes – 1 7
Group Yes – 1 Yes – 1 Yes – 1 7
Other Yes – 1 No – 0 Yes – 1 5

In order to change the ownership of a file, use the command “chown user:group file”.

Example :

How to restrict user resources

There might be a situation where the resources allocated for shell and processes need to be restricted. In such cases, use the command “ulimit”. The existing limits can be displayed using “ulimit -a”.

How to display the processes attached to open files

In order to display the list of processes attached to open files, use the command “lsof”.

Example :

To see the list of all the files opened by a specific user, use the command “lsof -u uid”.

Example :

System Log Files

There are various system logs. These are mainly used for troubleshooting issues and problems.

Some of the important logs are :

/var/log/syslog

/var/log/secure

/var/log/maillog

To view the timestamp of the last login of system users, use “lastlog” command.

Example :

To get the latest system messages to roll on the screen as they occur –

 

 

 

 

 

Scroll to Top