Linux

User account and process management in Linux

The process is a program in execution. The process is created when a command is to be executed so, it can be called a running instance of a program in execution. Tuning or controlling a process is called Process Management. There are two types of Linux processes, normal and real-time. Real-time processes have a higher priority than all of the other processes. If there is a real-time process ready to run, it will always run first. Real-time processes may have two types of policy, round-robin and first in first out

A user account is a technique for connecting a user and information service or computer network.  A user account is comprised of a username, password and any information related to the user.

Locking a users’ password:
– You can check the status of a user’s account with passwd –S username. To lock the password, use the command passwd –l username

You can also use grep username /etc/shadow to check the status of a user accounts password.

The presence of the exclamation mark (!) as shown above means the password is locked. To unlock the password, use usermod –U username

Expire an account.
– The above methods for locking a password or a user account will still allow a user to access his account by SSH authentication or other PAM modules even if the account is locked. To completely disable a user’s account, use the chage command.

chage –E0 username
– This will prevent every access to the account

Setting an account expiration date
– You can use the chage command to set an account to expire at a particular date. The format will be chage –E “year-mm-dd” username. The date within the quotation mark represents the expiry date.

you can now check the new account settings by using chage –l username

Kill a users session:
– You use can use the kill command to ‘kill’ a particular process after identifying the process i.d. As always, when running such a command, you have to be absolutely certain that is the process you want. To effectively kill a user’s session, you will need the tty and pid component. To do this, you can use the who command or just w

After getting the tty, use it to get the matching pid component with the command ps –ft tty as shown below

c
Now, you can kill the session using the pid. The command to use;

kill PID
For example;

kill 2757

or you can forcefully kill the process by using kill -9 2757 

I hope you found this blog post helpful. If you have any questions, please let me know in the comment session.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x