美图齐众专注资阳网站设计 资阳网站制作 资阳网站建设
资阳网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

详解FreeBSD中的常用操作

FreeBSD 是一个适用于现代服务器、桌面与嵌入式平台的先进操作系统。由一个庞大的开发人员团队持续开发超过三十年。FreeBSD先进的网络、安全性和存储方面的特色使得它成为许多大型网站以及最普遍的嵌入式网络与存储设备的平台选择,本篇文章重点为大家讲解一下FreeBSD中的常用操作。

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   #查看内存

本文名称:详解FreeBSD中的常用操作
分享网址:http://www.zsjierui.cn/article/dpicsho.html