?
Solved

Kill pids from users with restrictions

Posted on 2005-02-25
6
Medium Priority
?
364 Views
Last Modified: 2013-12-06
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
Comment
Question by:Xtry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:surya_prabhakar
ID: 13405614
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
 

Author Comment

by:Xtry
ID: 13405855
yes normally I do 'addduser username'
then they have acces through SSH on the shell
and they can run their processes from there.
0
 
LVL 7

Accepted Solution

by:
surya_prabhakar earned 2000 total points
ID: 13405932
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 7

Expert Comment

by:surya_prabhakar
ID: 13406721
Are you able to try this?
0
 
LVL 1

Expert Comment

by:wwanyhow
ID: 26550816
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
 
LVL 1

Expert Comment

by:wwanyhow
ID: 26550818
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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month11 days, 13 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question