免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1947 | 回复: 0

FreeBSD学习笔记 [复制链接]

论坛徽章:
0
发表于 2009-12-31 09:52 |显示全部楼层
本人在学习实践过程当中,摘录的一些学习笔记,比较乱但本人还是看得懂贴在这里以借以后查阅之用:
tail -f /var/log/squid/access.log | awk '{print$3 " " $8 " " $7}' 查看当前的HTTP连接情况
编译内核:
cd /sys/src/i386/conf
#make buildkernel KERNCONF=proxy
#make installkernel KERNCONF=proxy
两句也可合二为一:make kernel KERNCONF=proxy
在用户的/.cshrc中编辑加入指定的fetch网站地址:就可以用pkg_add -r {软体version}
setenv PACKAGEROOT      ftp://ftp.tw.freebsd.org
要指定首选安装源可以在/etc/make.conf中加入以下地址:
MASTER_SITE_OVERRIDE= \
ftp://ftp.tw.freebsd.org/pub/FreeBSD/ports/distfiles/ \
ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/distfiles/
FreeBSd登录到最高权限管理模式用命令SU:
> su
password:
#
IPF防火墙:
ipf -Fa -f /etc/ipf.rules
ipnat -CF -f /etc/ipnat.rules
查看状态:
ipfstat -ih 显示内部规则表中的进入流量,每一个匹配规则前面会同时显示匹配的次数。
ipfstat -oh 显示内部规则表中的流出流量,每一个匹配规则前面会同时显示匹配的次数。
ipfstat -iho
ipnat -l
ipfstat -s
netstat -l
netstat -r
netstat -i
vmstat
bsd 如何使用bsh? 按一下tab 有提示的那种 ls 如何有颜色?
1.csh 可以 alias ls ls -G, 以及 set autolist 实现你的要求
2.bash?
cd /usr/ports/shells/bash
make install clean
pw usermod root -s /usr/local/bin/bash
FreeBSd当中查找文件:
Fox example: find / |grep proxy
3.修改/etc/csh.cshrc
/etc/csh.cshrc
setenv LSCOLORS ExGxFxdxCxegedabagExEx
setenv CLICOLOR yes
set autolist
set prompt = '[%m%b] %B%~%b%# '
bindkey "^W" backward-delete-word
bindkey -k up history-search-backward
bindkey -k down history-search-forward
修改后执行
sed -i.bak -E s/set\ prompt/#set\ prompt/g /root/.cshrc
退出再进入
使用中文
# cd /usr/ports/chinese/big5con
# make install clean
rehash
b5c 测试
更改shell的显示方式
setenv EDITOR ee
alias ls ls -F
set prompt = "%B%m [%~] -%n-> "
查看当前使用的SHELL
echo $SHELL (注意大小写)
set prompt = "[%n@%B%m %~]"   顺序是:root@mansum.8800.org /etc/conf#
freebsd下ssh登录奇慢的问题
关闭SSH的dns反解析,即在/etc/ssh/sshd_config中添加:UseDNS no
然后把sshd reload一下:/etc/rc.d/sshd reload
自定义启动画面图案:
我在/boot/loader.conf中设置了如下:
splash_pcx_load="YES"
bitmap_load="YES"
bitmap_name="/boot/splash.bmp"
(4)添加用户
# pw groupadd vsftpd –g 1001
# pw useradd test –g 1001–d /home/test –s /sbin/nologin
# mkdir /home/test
# passwd test??????????????? 设密码
Changing local password for test
New Password:
Retype New Password:
FreeBSD指定 ports 所有 dist 文件下载地址
FreeBSD的port在make的时候默认从外国下载源码包,速度很慢。
做如下修改:
编辑/etc/make.conf
添加
MASTER_SITE_OVERRIDE=ftp://ftp.freebsdchina.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}
FreeBSD sshd/telnet禁止root登录的问题
ssh修改/etc/ssh/sshd_config更改PermitRootLogin no为PermitRootLogin yes
telnet修改/etc/login.access加入+:wheel:ALL
**********
更改开始时的欢迎信息
位于:ee /etc/motd
**********
freebsd ssh 服务器登录失败问题的解决
Submitted by lixiang on 六, 2005-11-12 16:03. FreeBSD系统
编辑/etc/ssh/sshd_config 保证设置以下参数:
PermitRootLogin yes
PasswordAuthentication yes
UseDNS no
LoginGraceTime 0
ipfw list
ipfw show
squid -NCd1
squid -z
squid start/restart/stop
squid
//忘记Root密码怎么办?
4.boot freebsd in single user mode 进入单用户模式
然后执行以下命令
fsck -p
mount -a -t ufs
swapon -a
passwd -l
接下来就是提示你输入新密码了
exit
自动重起好后用你重设的密码进系统
本文转载自『电影阁』:http://www.admin-s.cn/article.asp?id=2103
//# df -h         # df -ih        # du -h /etc     # du -sh /etc
# du /etc | sort -nr | more            # systat -vm
# diskinfo -v -t ad0參數會對硬碟做一些測試並回報結果
# mount device mount-point  # cd /  # umount /cdrom
//磁碟分割與格式化
執行指令 dmesg 或是 more /var/run/dmesg.boot,看看 FreeBSD 有沒有偵測新的硬碟 ad1
如果只是要馬上啟動服務只要執行:/usr/libexec/ftpd -D -l -l
webmin:http://mansum.8800.org:10000 user:admin Passwd:admin
安装webmin:#./setup.sh
Makefile 中的站点:/etc/make.conf
更新ports:在FreeBSD操作系统之下,首先portsnap fetch extract update更新ports
***************
squid 编译时,加入什么选项才能让出错信息变成中文?
编译时候不用,改配置文件就行了。
/etc/squid.conf :
# TAG: error_directory
# If you wish to create your own versions of the default
# (English) error files, either to customize them to suit your
# language or company copy the template English files to another
# directory and point this tag at them.
#
#Default:
error_directory /usr/share/squid/errors/Simplify_Chinese
********************************安装vsftp服务器***********************************
ps -ax|grep pam,你会发现login了多少个控制台
建立访问者的口令库文件,然后修改其权限
db_load –T –t hash –f /tmp/logins.txt /etc/vsftpd/vsftpd_login.db
在/etc/pam.d/中创建vsftpd.vu 添加
auth required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login  
pam_userdb.so在freebsd中对应哪个模块?
pam_userdb.so在freebsd中对应pam_login_access.so
**************************************************
不知道有没有人做过PAM虚拟用户+Vsftp+FreeBSD?
我看了很多资料都有一重要的一步,但都不说为什么那么做。
logins.txt
db_load -T -t hash -f logins.txt /etc/vsftpd_login.db
这个是基于linux的,并且有时候这个db_load会有版本区别。
要是在FreeBSD下怎么办呢?请教
**************************************************
freebsd下因为没有pam_userdb,跟普通的linux不太一样,推荐一个做法,也是看了老外的一个方法
http://dryice.name/blog/freebsd/ ... -vsftpd-on-freebsd/
I’ve done this before with the help of a very good blog entry. But when I tried to do the same thing today I can’t find that page. So I decide to write this down, in case I’ll need it later.
The most problem of setting up Vsftpd with file based virtual user on FreeBSD is that we don’t have pam_userdb. So we’ll use /usr/ports/security/pam_pwdfile instead.
So after installing the vsftpd and pam_pwdfile ports, do the following:
(1) in /etc/pam.d, make a file named “vsftpd” and put the following lines in it:
auth required /usr/local/lib/pam_pwdfile.so pwdfile /etc/vsftpd_login.db
account required /usr/lib/pam_permit.so
(2) make a password file with the apache htpasswd utility:
htpasswd -c -b /etc/vsftpd_login.db USERNAME PASSWORD
(3) make a local user with “nologin” as the shell and disable password login. I use “vsftp” for this.
(4) in /usr/local/etc/vsftpd.conf, disable anonymous access and enable local user access, and then add the following:
/usr/chroot_local_user=YES
guest_enable=YES
guest_username=vsftp
listen=YES
background=YES
pam_service_name=vsftpd
user_config_dir=/usr/local/etc/vsftpd
virtual_use_local_privs=YES
Note the value of “guest_usrname” is the local user name you made in step (3)
(5) make a directory /usr/local/etc/vsftpd, and write user specific configurations in a file named after the user’s login name. For example, someone with full write access will have something like this:
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_upload_enable=YES
write_enable=YES
(6) It should be OK now, add vsftpd_enable=”YES” into /etc/rc.conf as usual, and restart vsftpd to see if everything works fine.
*************************************************************
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/107631/showart_2136076.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP