FreeBSD学习笔记
本人在学习实践过程当中,摘录的一些学习笔记,比较乱但本人还是看得懂贴在这里以借以后查阅之用: tail -f /var/log/squid/access.log | awk '{print$3 " " $8 " " $7}' 查看当前的HTTP连接情况 编译内核: cd /sys/src/i386/conf #make buildkernel KERNCO
本人在学习实践过程当中,摘录的一些学习笔记,比较乱但本人还是看得懂贴在这里以借以后查阅之用:
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不太一样,推荐一个做法,也是看了老外的一个方法
[url]http://dryice.name/blog/freebsd/file-based-virtual-user-settings-for-vsftpd-on-freebsd/[/url]
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.
*************************************************************

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











How to delete Xiaohongshu notes? Notes can be edited in the Xiaohongshu APP. Most users don’t know how to delete Xiaohongshu notes. Next, the editor brings users pictures and texts on how to delete Xiaohongshu notes. Tutorial, interested users come and take a look! Xiaohongshu usage tutorial How to delete Xiaohongshu notes 1. First open the Xiaohongshu APP and enter the main page, select [Me] in the lower right corner to enter the special area; 2. Then in the My area, click on the note page shown in the picture below , select the note you want to delete; 3. Enter the note page, click [three dots] in the upper right corner; 4. Finally, the function bar will expand at the bottom, click [Delete] to complete.

As a Xiaohongshu user, we have all encountered the situation where published notes suddenly disappeared, which is undoubtedly confusing and worrying. In this case, what should we do? This article will focus on the topic of "What to do if the notes published by Xiaohongshu are missing" and give you a detailed answer. 1. What should I do if the notes published by Xiaohongshu are missing? First, don't panic. If you find that your notes are missing, staying calm is key and don't panic. This may be caused by platform system failure or operational errors. Checking release records is easy. Just open the Xiaohongshu App and click "Me" → "Publish" → "All Publications" to view your own publishing records. Here you can easily find previously published notes. 3.Repost. If found

As an email manager application, Microsoft Outlook allows us to schedule events and appointments. It enables us to stay organized by providing tools to create, manage and track these activities (also called events) in the Outlook application. However, sometimes unwanted events are added to the calendar in Outlook, which creates confusion for users and spams the calendar. In this article, we will explore various scenarios and steps that can help us prevent Outlook from automatically adding events to my calendar. Outlook Events – A brief overview Outlook events serve multiple purposes and have many useful features as follows: Calendar Integration: In Outlook

How to add product links in notes in Xiaohongshu? In the Xiaohongshu app, users can not only browse various contents but also shop, so there is a lot of content about shopping recommendations and good product sharing in this app. If If you are an expert on this app, you can also share some shopping experiences, find merchants for cooperation, add links in notes, etc. Many people are willing to use this app for shopping, because it is not only convenient, but also has many Experts will make some recommendations. You can browse interesting content and see if there are any clothing products that suit you. Let’s take a look at how to add product links to notes! How to add product links to Xiaohongshu Notes Open the app on the desktop of your mobile phone. Click on the app homepage

When editing text content in Word, you sometimes need to enter formula symbols. Some guys don’t know how to input the root number in Word, so Xiaomian asked me to share with my friends a tutorial on how to input the root number in Word. Hope it helps my friends. First, open the Word software on your computer, then open the file you want to edit, and move the cursor to the location where you need to insert the root sign, refer to the picture example below. 2. Select [Insert], and then select [Formula] in the symbol. As shown in the red circle in the picture below: 3. Then select [Insert New Formula] below. As shown in the red circle in the picture below: 4. Select [Radical Formula], and then select the appropriate root sign. As shown in the red circle in the picture below:

The Charm of Learning C Language: Unlocking the Potential of Programmers With the continuous development of technology, computer programming has become a field that has attracted much attention. Among many programming languages, C language has always been loved by programmers. Its simplicity, efficiency and wide application make learning C language the first step for many people to enter the field of programming. This article will discuss the charm of learning C language and how to unlock the potential of programmers by learning C language. First of all, the charm of learning C language lies in its simplicity. Compared with other programming languages, C language

PHP Coding Practices: Refusal to Use Alternatives to Goto Statements In recent years, with the continuous updating and iteration of programming languages, programmers have begun to pay more attention to coding specifications and best practices. In PHP programming, the goto statement has existed as a control flow statement for a long time, but in practical applications it often leads to a decrease in the readability and maintainability of the code. This article will share some alternatives to help developers refuse to use goto statements and improve code quality. 1. Why refuse to use goto statement? First, let's think about why

Dream Weaver CMS Station Group Practice Sharing In recent years, with the rapid development of the Internet, website construction has become more and more important. When building multiple websites, site group technology has become a very effective method. Among the many website construction tools, Dreamweaver CMS has become the first choice of many website enthusiasts due to its flexibility and ease of use. This article will share some practical experience about Dreamweaver CMS station group, as well as some specific code examples, hoping to provide some help to readers who are exploring station group technology. 1. What is Dreamweaver CMS station group? Dream Weaver CMS
