Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Ulimit permissions
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
gralves
Guru
Guru


Joined: 20 May 2003
Posts: 389
Location: Sao Paulo, Brazil

PostPosted: Tue Jun 22, 2004 6:02 am    Post subject: Ulimit permissions Reply with quote

Hi,

I'm trying to the maximum open file ammount to a user to 5000 on my machine using ulimit, but everytime I try that I get this error:

Code:

[gralves@gustavo][~]$ ulimit -n 5000
-bash: ulimit: open files: cannot modify limit: Operation not permitted
[gralves@gustavo][~]$


if I run the command as root it works but does not sets the limit for the user (only for root).

How do I do that? (Set the limit for a given user?) How do I change the "hard" limit?

Thanks,

Gustavo
Back to top
View user's profile Send private message
nizar
Apprentice
Apprentice


Joined: 19 Dec 2003
Posts: 268
Location: localhost

PostPosted: Tue Jun 22, 2004 6:41 am    Post subject: Reply with quote

Code:

ulimit [-SHacdflmnpstuv [limit]]

Provides control over the resources  available  to  the
shell  and  to processes started by it, on systems that
allow such control.  The value of limit can be a number
in  the  unit  specified for the resource, or the value
unlimited.  The -H and -S options specify that the hard
or  soft  limit  is set for the given resource.  A hard
limit cannot be increased once it is set; a soft  limit
may be increased up to the value of the hard limit.  If
neither -H nor -S is specified, both the soft and  hard
limits are set.  If limit is omitted, the current value
of the soft limit of the resource  is  printed,  unless
the -H option is given.  When more than one resource is
specified, the limit name and unit are  printed  before
the value.  Other options are interpreted as follows:

-a   All current limits are reported
-c   The maximum size of core files created
-d   The maximum size of a process's data segment
-f   The maximum size of files created by the shell
-l   The maximum size that may be locked into memory
-m   The maximum resident set size
-n   The maximum number of open file descriptors  (most
     systems do not allow this value to be set)
-p   The pipe size in 512-byte blocks (this may not  be
     set)
-s   The maximum stack size
-t   The maximum amount of cpu time in seconds
-u   The maximum number of  processes  available  to  a
     single user
-v   The maximum amount of virtual memory available  to
     the shell

If limit is given, it is the new value of the specified
resource (the -a option is display only).  If no option
is given, then -f is assumed.  Values are in  1024-byte
increments,  except  for  -t,  which is in seconds, -p,
which is in units of 512-byte blocks, and  -n  and  -u,
which  are  unscaled  values.   The  return status is 0
unless an invalid option is encountered, a  non-numeric
argument  other than unlimited is supplied as limit, or
an error occurs while setting a new limit.
Back to top
View user's profile Send private message
gralves
Guru
Guru


Joined: 20 May 2003
Posts: 389
Location: Sao Paulo, Brazil

PostPosted: Tue Jun 22, 2004 5:03 pm    Post subject: Reply with quote

I've read the manual but it didn't solve my question.

Root can change the ulimit above 5000 my question is then, how do I " upgrade" the ulimit of a given user (non-root) above the hard limit from the root account?
Back to top
View user's profile Send private message
junker
n00b
n00b


Joined: 17 Nov 2004
Posts: 2

PostPosted: Wed Nov 17, 2004 10:14 pm    Post subject: Reply with quote

>if I run the command as root it works but does not sets the limit for the >user (only for root).

>How do I do that? (Set the limit for a given user?) How do I change the >"hard" limit?

>Thanks,

>Gustavo

You can add these kind of entries in the /etc/security/limits.conf file.
Replase the * with a user name to only effect that user. Using the *
is not a good idea for security reasons. This example is from installing
Oracle and setting ulimit.

* -> -> soft -> nproc-> -> 2047
* -> -> hard -> nproc -> -> 16384
* -> -> soft -> nofile -> -> 2048
* -> -> hard -> nofile -> -> 16384

The -> symbol is tabs. nproc is for number of processes and nofile
is number of files. So when you login to the user defined the soft
limit is what you get. You can the increase it to the hard limit.
Back to top
View user's profile Send private message
junker
n00b
n00b


Joined: 17 Nov 2004
Posts: 2

PostPosted: Wed Nov 17, 2004 10:16 pm    Post subject: Reply with quote

Forgot another part of this. But I think most gentoo installs have this
already. But make sure you have the following entry in the
/etc/pam.d/login file.

session required /lib/security/pam_limits.so
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum