Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 368
  • Last Modified:

Kill pids from users with restrictions

Hello experts,
I would like to create a small script for my fedora core 1 server.

I have about 6 users and each user has different type of accounts,
Meaning that user1 can only run 4 pids and user2 only 1 pid etc..

Is there anyway to make a script that if user1 exceeds the limit to kill
his last pid?

thanks
0
Xtry
Asked:
Xtry
  • 3
  • 2
1 Solution
 
surya_prabhakarCommented:
those pid's relate to what process ...?
this is tricky there may be many background process which will be running under the user1 etc
how do the users login to the machine .

please update .

surya.
0
 
XtryAuthor Commented:
yes normally I do 'addduser username'
then they have acces through SSH on the shell
and they can run their processes from there.
0
 
surya_prabhakarCommented:
There is a better way of restricting number of process on the system for a user
there is a file called  /etc/security/limits.conf

open this file and add an entry like this at the bottom

user1     hard    nproc    4

add this before End of file line .

IF you spend 2 minutes reading this file you can play with it .
Once you save the file the restrictions are in force immediately .

surya.
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
surya_prabhakarCommented:
Are you able to try this?
0
 
wwanyhowCommented:
Surya,

You mentioned: "those pid's relate to what process ...?
this is tricky there may be many background process which will be running under the user1 etc
how do the users login to the machine ."

Is there a way to distinguish the background processes still running under user1 so we can kill the non-background processes?

I'm researching for a way to do that in AIX or Linux; any advice will be helpful, thx.
0
 
wwanyhowCommented:
Surya,

You mentioned: "those pid's relate to what process ...?
this is tricky there may be many background process which will be running under the user1 etc
how do the users login to the machine ."

Is there a way to distinguish the background processes still running under user1 so we can kill the non-background processes?

I'm researching for a way to do that in AIX or Linux; any advice will be helpful, thx.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now