Find the answer to your Linux question:
Results 1 to 6 of 6
Here's the problem !, I want some specific users on my box have higher user limits, to do some specific tasks, however ! I tried using the ulimit command, modifying ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2007
    Posts
    4

    Question User Limits In Linux


    Here's the problem !, I want some specific users on my box have higher user limits, to do some specific tasks, however !
    I tried using the ulimit command, modifying the /etc/security/limits.conf and /etc/profile ! but I still get the `uname -n` = 100 !

    can anyone help help me with this issue or provide me some link and/or instruction to do this type of work, btw I'm using a CentOS 4 box ...

    --
    Regards ...

  2. #2
    Just Joined!
    Join Date
    Apr 2007
    Posts
    4

    Exclamation

    It's been about a week but no reply ! ...
    But I'd appreciate any idea anyways ...

    --
    Regards ...

  3. #3
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    I want some specific users on my box have higher user limits, to do some specific tasks
    What do you mean? Give examples of the problem you're trying to solve.

  4. #4
    Just Joined!
    Join Date
    Apr 2007
    Posts
    4
    Quote Originally Posted by anomie
    What do you mean? Give examples of the problem you're trying to solve.
    Thanks 4 the reply !!

    Well let's be more specific, I need a user have it's `ulimit -n` set to 2048 while all other users (except for root) has a 256 value for their open files !

    I've edited the /etc/security/limits.conf and added :

    ricd hard nofile 2048
    ricd soft nofile 1024
    and added these lines to the /etc/profile :

    if [ `/usr/bin/whoami` = "ricd" ]; then
    ulimit -n 1024 2>/dev/null
    fi
    But I still get the `ulimit -n` 100 for the ricd user

  5. #5
    Linux Guru anomie's Avatar
    Join Date
    Mar 2005
    Location
    Texas
    Posts
    1,692
    I'm pretty sure /etc/profile gets run as root, so your conditional test will always be false.

    Could you just add the ulimit specification to ricd's ~/.bash_profile?

  6. #6
    Just Joined!
    Join Date
    Apr 2007
    Posts
    4

    Lightbulb

    Quote Originally Posted by anomie
    I'm pretty sure /etc/profile gets run as root, so your conditional test will always be false.

    Could you just add the ulimit specification to ricd's ~/.bash_profile?
    Well, @ first I thought this might be the problem that /etc/profile runs as root, but some time ago I read the cPanel 10 Documention, and there is a block of code (that right now I copied from the documention here) added to /etc/profile !

    Code:
    #cPanel Added Limit Protections -- BEGIN
    
    #unlimit so we can run the whoami
    ulimit -n 4096 -u 14335 -m unlimited -d unlimited -s 8192 -c 1000000 -v unlimited 2>/dev/null
    
    LIMITUSER=$USER
    if [ -e "/usr/bin/whoami" ]; then
            LIMITUSER=`/usr/bin/whoami`
    fi
    if [ "$LIMITUSER" != "root" ]; then
            ulimit -n 512 -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
    #cPanel Added Limit Protections -- END
    So, this tells me /etc/profile does not run as root I think !
    Well, I tried adding
    Code:
    if [ -e "/usr/bin/whoami" ]; then
            LIMITUSER=`/usr/bin/whoami`
    fi
    and then using the conditional sentence with $LIMITUSER, but I still hae the same old problem !

    about the ~/.bash_profile idea, I'll check it

    Thanks again

    --- UPDATE ---

    I've tried adding the following line to the .bash_profile :
    Code:
    ulimit -n 1024 2>/dev/null
    But I get the same result !!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •