-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathchapter.faq.xml
105 lines (93 loc) · 3.06 KB
/
chapter.faq.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?xml version="1.0" encoding="UTF-8"?>
<chapter id="faq">
<title>FAQ</title>
<section id="faq.limit">
<title>Linux用户使用FreeBSD,问FreeBSD ulimit怎么设置?</title>
<para>首先说明FreeBSD默认Shell是csh没有ulimit命令,但C Shell有limit命令。如果你想使用ulimit命令可以安装Bourne shell,Bash,Zsh</para>
<para>limit,ulimit比较</para>
<screen>
[neo@freebsd:~] limit
cputime unlimited
filesize unlimited
datasize 32768MB
stacksize 512MB
coredumpsize unlimited
memoryuse unlimited
memorylocked unlimited
maxproc 5547
descriptors 65536
sockbufsize unlimited
vmemorysize unlimited
NPTS unlimited
SWAP unlimited
[neo@freebsd:~] env | grep SHELL
SHELL=/usr/local/bin/zsh
[neo@freebsd:~] ulimit -a
-t: cpu time (seconds) unlimited
-f: file size (blocks) unlimited
-d: data seg size (kbytes) 33554432
-s: stack size (kbytes) 524288
-c: core file size (blocks) unlimited
-m: resident set size (kbytes) unlimited
-l: locked-in-memory size (kb) unlimited
-u: processes 5547
-n: file descriptors 65536
-N 9: socket buffer size (kb) unlimited
-v: virtual memory size (kb) unlimited
-N 11: unlimited
-N 12: unlimited
在Freebsd上,你能使用sysctl命令:
</screen>
<para>以 nofile - max number of open files 为例,limit、ulimit、sysctl实现同样的功能。</para>
<screen>
csh% limit descriptors unlimited
或者
csh% limit descriptors 4096
sh$ ulimit -n unlimited
或者
sh$ ulimit -n 4096
sysctl kern.maxfiles=65536
sysctl kern.maxfilesperproc=65536
</screen>
<para>写入配置文件 sysctl.conf</para>
<screen>
[neo@freebsd:~] cat /etc/sysctl.conf
# $FreeBSD: src/etc/sysctl.conf,v 1.8.34.1.4.1 2010/06/14 02:09:06 kensmith Exp $
#
# This file is read when going to multi-user and its contents piped thru
# ``sysctl'' to adjust kernel values. ``man 5 sysctl.conf'' for details.
#
# Uncomment this to prevent users from seeing information about processes that
# are being run under another UID.
#security.bsd.see_other_uids=0
#vm.pmap.shpgperproc: 2000
#vm.pmap.pv_entry_max: 13338058
kern.ipc.shm_use_phys=1
kern.maxfiles=65536
kern.maxfilesperproc=65536
kern.ipc.somaxconn=2048
[neo@freebsd:~] /etc/rc.d/sysctl reload
[neo@freebsd:~] sysctl -a | grep maxfiles
kern.maxfiles: 65536
kern.maxfilesperproc: 65536
</screen>
</section>
<section id="su.sorry">
<title>su: Sorry</title>
<screen>
root@freebsd:/root # pw groupmod wheel -m test
root@freebsd:/root # cat /etc/group | grep test
wheel:*:0:root,neo,test
test:*:1002:
</screen>
<screen>
root@freebsd:/root # pw usermod test -g wheel
root@freebsd:/root # cat /etc/passwd | grep test
test:*:1002:0:test:/home/test:/bin/csh
</screen>
<para>或者直接修改/etc/group文件,把相应的用户加到wheell组就可以</para>
<screen>
wheel:*:0:root,username
</screen>
</section>
</chapter>