1834780 Members
2953 Online
110070 Solutions
New Discussion

Re: user limit

 
piyut_1
Frequent Advisor

user limit

dear,

I want to change user limit for specific user.
the old limit:
core file size (blocks) 2097151
data seg size (kbytes) 262144
file size (blocks) unlimited
max memory size (kbytes) unlimited
open files 60
pipe size (512 bytes) 16
stack size (kbytes) 8192
cpu time (seconds) unlimited
max user processes 76
virtual memory (kbytes) unlimited

I want to changet with:
core file size (blocks) 2097151
data seg size (kbytes) 2015436
file size (blocks) unlimited
max memory size (kbytes) unlimited
open files 2048
pipe size (512 bytes) 16
stack size (kbytes) 81920
cpu time (seconds) unlimited
max user processes 513
virtual memory (kbytes) unlimited

what command that will run to change this user limit ??




12 REPLIES 12
Bill Hassell
Honored Contributor

Re: user limit

ulimit is a built-in shell command so it can only be changed in the user's shell. You can make the change in the user's .profile but the user can remove the changes. The best location is in /etc/profile since users can't change the file. Just add a test for this specific user in /etc/profile and use ulimit to make the changes.


Bill Hassell, sysadmin
Ravi_8
Honored Contributor

Re: user limit

Hi

ulimit

look at man pages of ulimit
never give up
piyut_1
Frequent Advisor

Re: user limit

thx, but i don't understand in manual page for ulimit.
can you give what command must I do to change user limit max user process??

thx,

piyut
Bill Hassell
Honored Contributor

Re: user limit

The man page for ulimit is only for programmers. The man page for ulimit as a shell command is contained in the shell man pages, specifically, man sh-posix and man ksh. To set a limit value for core file limits, use:

ulimit -c 2097151

If the user types the above command, the current session environment will now limit all core dumps to 2megs. Now if these changes are needed to control a user's activity, you can modify the user's profile by adding the ulimit commands to the user's $HOME/.profile file. If the user wants to abuse the settings and either removes the commands from .profile or changes them to other values, put the commands into /etc/profile as mentioned above, something like this:

LIMITUSER=billh
if [ $(ulimit -un) = $LIMITUSER ]
then
ulimit -c 2097151
ulimit -d 2015436
... more ulimit commands ...
fi

Now the above list does not look like the standard HP-UX POSIX sh or ksh ulimit command output. Is this HP-UX for PA-RISC or Itanium? Several of the above parameters are not ulimit values in HP-UX (pipe size, max user processes, virtual memory, max memory size)


It looks like ulimit from a Linux system. If so, you'll need to read the man pages for the shell for that user (man bash perhaps).


Bill Hassell, sysadmin
Bharat Katkar
Honored Contributor

Re: user limit

Hi,
As alredy suggested you can set ulimit parameters in .profile file.

1. ulimit -a
Display all configured values.
2. ulimit -c
Sets core file size
3. ulimit -d
Sets data seg size
4. ulimit -n
Sets Open Files
5. ulimit -s
Sets stack size
6. ulimit -u
Sets max user processes
7. ulimit -t
Sets cpu time
8. ulimit -v
Sets virtual memory
9. ulimit -p
Sets pipe size

ulimit -p
This will display current Pipe Size Configured,


Hope that helps.
Regards,
You need to know a lot to actually know how little you know
piyut_1
Frequent Advisor

Re: user limit

dear,

as root, I can changed $HOME/.profile, (#vi /home/wmuser/.profile), but when I try to su - wmuser (#su - wmuser) , there are errors like this:
bash: ulimit: cannot modify limit: Not owner
bash: ulimit: cannot modify limit: Not owner
bash: ulimit: cannot modify limit: Not owner

when i try to change .profile as user, there is an error "permission denied" when i want to save file.anither error like this:

$ ulimit -d 2015436
sh: ulimit: The specified value exceeds the user's allowable limit.
$ ksh
$ ulimit -d 2015436
ksh: ulimit: exceeds allowable limit


Bill Hassell
Honored Contributor

Re: user limit

su is not like a normal login. It is a method to attain the user's rights and ownership but your original user login is still in the background. Now it's importsant to identify who owns the .profile file (use ls -l $HOME/.profile). Also, bash has a very complex set of potential profile files, not just .profile. And again, if you are running HP-UX and not Linux, the -d option for thye data area is much smaller than 2Gb, typically 64megs for early 11.11 and 11.0. This is a kernel parameter (maxdsiz) which affects all users and all processes. You can change maxdsiz to 1000megs, even 1800megs but 32 bit programs must use special options during compilation to use more than 960 megs. And make sure that maxdsiz_64 is larger than maxdsiz.


Bill Hassell, sysadmin
piyut_1
Frequent Advisor

Re: user limit

bill,

.profile that i changed is belongs to wmuser, user that i want to change.

#ls -l /home/wmuser
-r--r--r-- 1 wmuser wmgroup 523 Feb 15 10:16 .profile

Configure parameter :
maxdsiz 268435456 268435456 Static N/A M
maxdsiz_64bit 1073741824 1073741824 Static N/A M



Bill Hassell
Honored Contributor

Re: user limit

maxdsiz is only 256megs (which is the default for 11.11. You need to change the kernel parameter maxdsiz to more than 2Gb. NOTE: ulimit reports the data segment size in Kbytes but SAM uses just plain bytes. For 2Gb ulimit to work, maxdsiz should be 2015436000, or round it up to 2100000000 and ulimit should now work OK.


Bill Hassell, sysadmin
piyut_1
Frequent Advisor

Re: user limit

thx bill,

yesterday, i changed kernel configurations.
maxdsiz :2063806464
maxdsiz_64bit :2063806464
and output of ulimit -a:
core file size (blocks) 2097151
data seg size (kbytes) 2015436
file size (blocks) unlimited
max memory size (kbytes) unlimited
open files 2048
pipe size (512 bytes) 16
stack size (kbytes) 8192
cpu time (seconds) unlimited
max user processes 513
virtual memory (kbytes) unlimited

now, i have problem to change stack size to 81920.when I run "ulimit -s 81920" there are errors:

bash-2.04$ ulimit -s 81920
bash: ulimit: cannot modify limit: Not owner
bash-2.04$ ksh
$ ulimit -s 81920
ksh: ulimit: exceeds allowable limit
$ sh
$ ulimit -s 81920
sh: ulimit: The specified value exceeds the user's allowable limit.

what wrong bill ???




Bill Hassell
Honored Contributor

Re: user limit

32 bit programs (as mentioned before) have severe limitations on maximum addresses. For virtually all programs, a stack needs only to be a few megs. Anything more than 10 megs sounds like a programming problem. The hard limit for a 32bit stack is 79megs.

All of these requests sound like a program that can't run because memory isn't available. Virtually all memory problems for large programs are due to not understanding how a 32bit program is mapped. If you recompile the program as a 64bit program, these limitations go away. Without going into great details, 32bit programs have a maximum data area (regardless of higher ulimit values) of about 960mes, the stack is just under 79megs and shared memory is split among all other shared memory programs in the system. There are several compile options, as well as memory windows that can extend these limits. Have your programmers read the white papers in /usr/share/doc on proc_mgt and mem_mgt (11.00 and earlier systems)


Bill Hassell, sysadmin
piyut_1
Frequent Advisor

Re: user limit

dear bill,

I think we must change parameter maxssiz and maxssiz_64bit (max stack segment for 32 bit and 64 bit) and make to reboot.

thanks bill.