导读 最近遇到一些FreeBSD的故障,在这种操作系统上我们平时用的一些无法执行,FreeBSD的一些配置文件也和其他很多Linux系统不一样。为了方便以后查阅,我特别整理了这篇文档。
1. 网络

重启网络的:

/etc/rc.d/netif restart , /etc/netstart restart

网络配置文件:

root@mhxy-compile02:~ # cat /etc/rc.conf
ifconfig_em0="DHCP"
sshd_enable="NO"
ntpd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"
puppet_enable="YES"
ipv6_enable="NO"

hostname="mhxy-compile02.i.nease.net"

nfs_client_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
2. SSH

命令:

/etc/rc.d/sshd start , /etc/rc.d/sshd restart

SSH配置文件:

root@mhxy-compile02:~ # cat /etc/ssh/sshd_config 
# THIS FILE IS AUTOMATICALLY GENERATED BY PUPPET.
# DO NOT EDIT THIS FILE.

# 1. Basic
Port 32200
Protocol 2


# 2. Authentication
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key

KeyRegenerationInterval 3600
ServerKeyBits 768
UsePrivilegeSeparation yes
LoginGraceTime 120

PermitRootLogin no
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication no

IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no


# 3. Features
UseDNS no
X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
AcceptEnv LANG LC_*


# 4. Logging
SyslogFacility AUTH
LogLevel INFO


# 5. x509
Subsystem sftp /usr/libexec/sftp-server
#CACertificateFile /etc/ssh/ca/ca.cer
3. 防火墙
1)停止ipfw防火墙: 
ipfw disable firewall  
/etc/rc.d/ipfw stop

2)开启ipfw防火墙:

ipfw enable firewall  
/etc/rc.d/ipfw start

3)清防火墙
ipf -Fa
4.赋予用户root权限
1)pw groupmod wheel -m 
2)pw user mod  -g wheel
5.查看CPU和内存
1)sysctl kern.smp.cpus或dmesg |grep cpu  #查看CPU个数
2)dmesg|more或top   #查看内存

本文原创地址://q13zd.cn/freebsd-common-operation.html编辑:public,审核员:逄增宝