The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

bash: fork: Resource temporarily unavailable

Discussion in 'General Discussion' started by linuxnewbie, Sep 13, 2002.

  1. linuxnewbie

    linuxnewbie Member

    Joined:
    Aug 23, 2002
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    &bash: fork: Resource temporarily unavailable&

    a client (only this 1 guy) gets this message once he is logged in via ssh and tries to run any command.

    ex: he types &ls& and he gets the above message

    anybody know whats wrong or how to fix this?

    thanks
     
  2. mesranet

    mesranet Well-Known Member

    Joined:
    May 6, 2002
    Messages:
    126
    Likes Received:
    0
    Trophy Points:
    16
    Login to WebHostManager - Shell Fork Bomb Protection - Disable it :)
     
  3. Ronny

    Ronny Well-Known Member

    Joined:
    Dec 27, 2002
    Messages:
    63
    Likes Received:
    0
    Trophy Points:
    6
    Well I'd like to have that protection on..... why would it display such a message if the client hasn't done anything? I mean an ls isn't going to cause a fork bomb
     
  4. myusername

    myusername Well-Known Member
    PartnerNOC

    Joined:
    Mar 6, 2003
    Messages:
    691
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    chown -R us.*yourbase*
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    I have the same problem for a user, and also would like to maintain that protection.
     
  5. alareach

    alareach Well-Known Member

    Joined:
    Aug 12, 2001
    Messages:
    57
    Likes Received:
    0
    Trophy Points:
    6
    follow up?

    Any further info on this? Just happened to one of our very long running & stable boxes. Got an email that

    /bin/sh: fork: Resource temporarily unavailable

    ....services started failing, and now can't get into ssh or whm to reboot.
     
  6. Nico

    Nico Well-Known Member

    Joined:
    Dec 5, 2001
    Messages:
    233
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Edmond, OK
    I had this same problem this AM I corrected it like this:
    SSH in as root
    ps -aux |grep username
    (replace username with the user getting this error) You should see all the processes they have running. If you kill those off they can log in afterwards.
     
  7. DARKMAN

    DARKMAN Registered

    Joined:
    Jan 1, 2004
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Sibenik, Croatia
    same here

    i'm having same problems.
    Disable fork bomb protection is not an option and killing processes also!

    Any solutions?
    :confused:
     
  8. cornernote

    cornernote Member

    Joined:
    Nov 9, 2003
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    6
    Hello,

    Is there a way to increase the number of processes that a user is allowed to run?

    Brett
     
  9. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Edit /etc/profile and make an exception for the user that you want to change the value for.
     
  10. cornernote

    cornernote Member

    Joined:
    Nov 9, 2003
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    6
    Hello Chirpy,

    I looked at the file but because I don't understand it 100% and I dont want to break it I did not change anything. Would you be able to tell me what I should change?

    I tried changing this:
    Code:
    if [ "$LIMITUSER" != "root" ]; then
            ulimit -n 100 -u 20 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
    else
            ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
    fi
    To This:
    Code:
    if [ "$LIMITUSER" == "root" ]; then
            ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
    else if [ "$LIMITUSER" == "fasthost" ]; then
            ulimit -n 500 -u 100 -m 1000000 -d 1000000 -s 8192 -c 1000000 -v 1000000 2>/dev/null
    else
            ulimit -n 100 -u 20 -m 200000 -d 200000 -s 8192 -c 200000 -v 200000 2>/dev/null
    fi

    But this results in:
    bash: /etc/profile: line 68: syntax error: unexpected end of file



    Best regards,
    Brett
     
    #10 cornernote, Jan 30, 2005
    Last edited: Jan 30, 2005
  11. cornernote

    cornernote Member

    Joined:
    Nov 9, 2003
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    6
    I changed "else if" to "elif" and it worked. Go figure :rolleyes:
     
  12. cornernote

    cornernote Member

    Joined:
    Nov 9, 2003
    Messages:
    24
    Likes Received:
    0
    Trophy Points:
    6
    Even if I give my account the same settings as root, it still does the same thing. Yet when I log in as root and "sh" to my user, it works fine.

    Brett
     
  13. chirpy

    chirpy Well-Known Member

    Joined:
    Jun 15, 2002
    Messages:
    13,475
    Likes Received:
    20
    Trophy Points:
    38
    Location:
    Go on, have a guess
    Looks like you may need to make the change in a few other files, though I don't know which take precedence:

    /etc/profile
    /etc/bashrc
    /etc/profile.d/limits.sh

    I cannot say that I've ever tried playing with it, though ;)
     
  14. Norman

    Norman Well-Known Member

    Joined:
    Sep 20, 2004
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    FWIW.. I found this with a user.. who when we enabled Fork Bomb Protection, when using IMAP with alot of email accounts would not be able to login via shell.

    If you do a "ps -ef | grep <username>" and see a bunch of imapd .. that's one of the reasons.

    Just my 2cents worth. :)
     
  15. Devil Inside

    Devil Inside Well-Known Member

    Joined:
    Apr 4, 2003
    Messages:
    277
    Likes Received:
    0
    Trophy Points:
    16
    I made the changes that were mentioned in this thread - however, I'm still getting the "line 70: syntax error: unexpected end of file" error after changing "else if" to "elif"

    Any ideas?
     
  16. Devil Inside

    Devil Inside Well-Known Member

    Joined:
    Apr 4, 2003
    Messages:
    277
    Likes Received:
    0
    Trophy Points:
    16
    Any ideas?

    SSH works - but the error is rather annoying to my clients :)
     
  17. npereira

    npereira Member

    Joined:
    Apr 30, 2003
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    1
    This was happening on one of my accounts, and I suspended the account, then re-enabled it and all is fine now.... !
     
  18. Abhilash V Nair

    Abhilash V Nair Registered

    Joined:
    Aug 7, 2006
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Hi All,

    This thread was helpful to me to a large extent. So I want this thread to be more clear for all who have the same issue and i think this thread will give answer to the previous query .

    As Chirpy mentioned we have to make changes on the three files but the changes are same.

    the files to be changed are

    /etc/profile
    /etc/bashrc
    /etc/profile.d/limits.sh

    As Brett told there will be some what similar lines as given in the quote but the values may have difference.

    The mentioned lines gives unlimited access to the root user but generally there will not be direct ssh acces through root while thinking about security purposes. Here all other users have only limited access. To give unlimited access to a user say 'USER1' chnge this line to

    This is a very simple change while we think with the logic of if loop. You have to make changes in all the three files mentioned like this. All other users except root and USER1 will have only limited access.

    If anyone find anything wrong in this post please point it as I am new to this field.

    Really Thanks for Chirpy and Brett as they were the persons who showed me the path to move forward in this case.

    Thanks for your time. :)

    ---
    Regards,
    Abhilash V Nair
     
  19. professor_kurie

    professor_kurie Registered

    Joined:
    May 25, 2006
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Thank you

    Thank you Abhilash. The post is really informative
     
  20. xfob

    xfob Member

    Joined:
    Jul 17, 2007
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I Googled this topic for 2.5 hours and found nothing. I wish I had came here first... Thanks for the awesome posts.
     
Loading...

Share This Page