Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When my server runs into out-of-memory, it usually kills several applications. Is there any way how can i prevent from killing SSH. Because usually, when this out-of-memory error happens, my SSH is broken like this:

I connect to ssh server.
Enter username
Enter password
and then i wait
i wait
and wait...
and waaaaaaaaaait..
and then: Connection timed out.

Is there any way to prevent this?

share|improve this question

The renice command can be used to reset the priority of running processes or control the priority and scheduling of all processes owned by a user. Regular users can only numerically increase process priorities (that is, make tasks less important) using this command, but the root operator can use the full nice range of scheduling (-20 to 19). Lower number is higher priority. Most processes seem to run at nice of 0. If you run CLI top you'll see your running processes. The column labeled NI is the nice number. If you run CLI nice with no parameters you'll see:


 renice [-n] priority [-p|--pid] pid  [... pid]

 renice [-n] priority  -g|--pgrp pgrp [... pgrp]

 renice [-n] priority  -u|--user user [... user]

 renice -h | --help

 renice -v | --version

I suggest you experiment as I have no infinite wisdom as to the right nice value for your purposes.

share|improve this answer

Raise the niceness. Low-priority apps are killed first.

share|improve this answer
How can i do that? – Riki137 May 7 '11 at 18:59
How can i do that, please? – Riki137 May 15 '11 at 18:06
Can you expand your answer as to how these so-called low-priority apps can be killed? – Peachy Sep 7 '12 at 21:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.