Entries Tagged as ''

linux下听mp3需要单装mp3的plugin

我在FC4(Fedora core 4)的环境下

yum install xmms

之后

发现还是放不了mp3

提示是由于mp3的专利问题

所以xmms没有把mp3的支持加进来

要听mp3需要手工安装mp3 plugin for xmms

我找了一下

原来在这里:

http://www.gurulabs.com/goodies/downloads.php

这是for Fedora core 4

而且

听wma的歌曲也需要plugin

在这里

http://mcmcc.bat.ru/xmms-wma/

enjoy it

selinux又作怪,致使php程序web上出奇怪的问题

在FC4(fedora core 4)下

httpd2.0.54+php5

测一个巨简单的php程序

[root@sohu steps]# cat test.php

<?php

if(file_exists("/www/config.php")) {

        if (($o = fopen("/www/config.php", "w")) == TRUE) {

                print "OK";

        } else {

                print "pei";

        }

}

?>

在web页面上看始终是显示“pei”

在本机命令行用php test.php来看

始终显示"OK"

而且用跑httpd的apache的身份来执行php test.php也显示"OK"

而且php.ini文件也没有什么问题

是在是不明白了



最后

想想会不会是selinux搞的鬼呢

于是

死马当活马医

setenforce 0

(这个命令是用来disable掉selinux的)

再一试

居然好了!!

KDE3的汉字显示美化

前段时间在桌面上装了个Fc4(Fedora Core 4)

里面带的kde是3.4.2的

现在的kde对汉化的支持已经支持得很好了

只是由于现在没有太好的免费的汉字truetype字体

 (网上大家常用的windows的simsun的字体是有版权的,不能随便使用的)

这里有目前常见的免费的简体字体

自从台湾文鼎公司免费发布了AR PL New Sung字体后

现在linux桌面美化有了新的选择

 

下面具体讲在fedora core 4(kde3.4.2)下怎样利用这个字体

首先把这个字体文件当下来

我当下来的是fireflysung-1.3.0.tar.gz

tar xzvf fireflysung-1.3.0.tar.gz

cd fireflysung-1.3.0

cp fireflysung.ttf /usr/local/share/fonts/

然后退出

重起kde

再登入

点“开始”—->“控制中心

再点“外观和主题”下面的“字体

再点“调整全部字体(J)…

然后选中“AR PL New Sung”字体,字号选10

OK了

kde下能这么做

gnome下我想也差不多

Fc3、Fc2或者是其他linux甚至于其他能跑kde的都应该可以这么做

Linux下怎样启动vncserver(HOWTO - Linux VNCserver)

自己有台FC4(Fedora Core 4)的桌面后免不了要从别的地方登过来

于是我就在自己机器上起了个vnc server

/etc/rc.d/init.d/vncserver start

发现用vncviewer用ip连不了

查了些文档才搞明白

vi /etc/sysconfig/vncservers

让里面有这么两句:

VNCSERVERS="2:root"

VNCSERVERARGS[2]="-geometry 1024×768"

这里因为我的桌面本来就用了个x显示所以这里用2

后面的"root"代表是用root用户启

第二句的"1024×768"本来一般都是800×600

我嫌分辨率太小自己改了

然后services vncserver restart

接着用vncpasswd设置vnc连过来的密码

再用vncviewer用ip:2(如10.0.0.1:2)来连

输入密码

OK

能连上

只不过现在只能显示很简陋的twm窗口

怎样才能登上来显示得就像我本机的一样是kde呢

也有办法

vi ~/.vnc/xstartup

将本来注释掉的这两句的前面的注释符"#"去掉(文件头里有提示)

变成这样

unset SESSION_MANAGER

exec /etc/X11/xinit/xinitrc

注意:后面的不变

就行了

service vncserver restart

再登上去就完全可以了

hp dl380G4的机器安装Fedora Core 3启动不了系统的问题

公司进了一批hp dl380G4的机器

产品那边非要linux 2.6的kernel不可

那会儿想不出什么版本的Linux有2.6的kernel的发布

而且还比较好一些 就先入为主的用了redhat的Fedora Core 3

没想到安装完成后启动不了机器 去找hp的人

回答是问我们为什么不用as3

我们说我们要2.6的kernel的

hp的人说redhat发布的as3里虽然还是2.4的kernel

但是已经被redhat的人加了好些2.6的特性进去

并说Fedora不在hp dl380G4的支持范围之内

而且还巨罗嗦 知道我们忍无可忍

以这个会影响到我们公司下单为由

他们才老实一些 ^_^

 看来只有靠自己弄咯 去网上搜,发现: http://www.fedoraforum.org/forum/archive/index.php/t-26594.html



按照提示

装的时候用lilo取代grub就解决问题了

What is the “TCP: Treason uncloaked” & what is the “tar-pit” attack

一台as3u4的机器
跑的是apache
老当
log信息里有大量的像这样:
TCP: Treason uncloaked! Peer 219.159.0.206:38027/80 shrinks window 46627817:46628657. Repaired.
TCP: Treason uncloaked! Peer 211.95.123.92:1544/80 shrinks window 1102445781:1102447629. Repaired.
TCP: Treason uncloaked! Peer 211.95.123.92:1545/80 shrinks window 1105180279:1105182127. Repaired.
TCP: Treason uncloaked! Peer 211.95.123.92:1544/80 shrinks window 1102445781:1102447629. Repaired.
TCP: Treason uncloaked! Peer 211.95.123.92:1545/80 shrinks window 1105180279:1105182127. Repaired.
TCP: Treason uncloaked! Peer 211.95.123.92:1544/80 shrinks window 1102445781:1102447629. Repaired.
TCP: Treason uncloaked! Peer 211.95.123.92:1545/80 shrinks window 1105180279:1105182127. Repaired.
TCP: Treason uncloaked! Peer 218.61.124.147:1471/80 shrinks window 2337291759:2337304798. Repaired.
TCP: Treason uncloaked! Peer 218.61.124.147:1471/80 shrinks window 2337291759:2337304798. Repaired.
TCP: Treason uncloaked! Peer 218.86.185.83:45888/80 shrinks window 4264527395:4264531535. Repaired.
TCP: Treason uncloaked! Peer 218.86.185.83:45888/80 shrinks window 4264527395:4264531535. Repaired.
TCP: Treason uncloaked! Peer 218.86.185.83:45888/80 shrinks window 4264527395:4264531535. Repaired.
TCP: Treason uncloaked! Peer 211.161.137.254:39411/80 shrinks window 2639411767:2639413227. Repaired.

这样的信息
网上搜
大多说这可能有人在跑一种叫tar-pit的程序来攻击
这种攻击最后的结果就是让你当机
但好像没提到什么实用的解决方法

同是hp dl380 G4的机器,网卡居然都不一样!

看型号都是hp ncxxxx什么什么
但芯片都不一样
有Intel的
也有bcm的
搞不懂
郁闷

FreeBSD4.x下用ipf做的本机防火墙

在文件/etc/rc.conf中设定:

ipfilter_enable=”YES”
ipfilter_rules=”/etc/ipf.rules”
ipmon_enable=”YES” # optional
ipmon_flags=”-Ds” # optional

bash-2.05b# cat /etc/ipf.rules
#######################################################
# No restrictions on Inside LAN Interface for private network
# Not needed unless you have LAN
#######################################################

#pass out quick on xl0 all
#pass in quick on xl0 all

#######################################################
# No restrictions on Loopback Interface
#######################################################
pass in quick on lo0 all
pass out quick on lo0 all

#######################################################
# Interface facing Public Internet (Outbound Section)
# Interrogate session start requests originating from behind the
# firewall on the private network
# or from this gateway server destine for the public Internet.
#######################################################

# Allow out access to my ISP’s Domain name server.
# xxx must be the IP address of your ISP’s DNS.
# Dup these lines if your ISP has more than one DNS server
# Get the IP addresses from /etc/resolv.conf file
pass out quick on xl0 proto tcp from any to xxx port = 53 flags S keep state
pass out quick on xl0 proto udp from any to xxx port = 53 keep state

# Allow out access to my ISP’s DHCP server for cable or DSL networks.
# This rule is not needed for ‘user ppp’ type connection to the
# public Internet, so you can delete this whole group.
# Use the following rule and check log for IP address.
# Then put IP address in commented out rule & delete first rule
pass out log quick on xl0 proto udp from any to any port = 67 keep state
#pass out quick on xl0 proto udp from any to z.z.z.z port = 67 keep state

# Allow out non-secure standard www function
pass out quick on xl0 proto tcp from any to any port = 80 flags S keep state

# Allow out secure www function https over TLS SSL
pass out quick on xl0 proto tcp from any to any port = 443 flags S keep state

# Allow out send & get email function
pass out quick on xl0 proto tcp from any to any port = 110 flags S keep state
pass out quick on xl0 proto tcp from any to any port = 25 flags S keep state

# Allow out Time
pass out quick on xl0 proto tcp from any to any port = 37 flags S keep state

# Allow out nntp news
pass out quick on xl0 proto tcp from any to any port = 119 flags S keep state

# Allow out gateway & LAN users non-secure FTP ( both passive & active modes)
# This function uses the IPNAT built in FTP proxy function coded in
# the nat rules file to make this single rule function correctly.
# If you want to use the pkg_add command to install application packages
# on your gateway system you need this rule.
pass out quick on xl0 proto tcp from any to any port = 21 flags S keep state

# Allow out secure FTP, Telnet, and SCP
# This function is using SSH (secure shell)
pass out quick on xl0 proto tcp from any to any port = 22 flags S keep state

# Allow out non-secure Telnet
pass out quick on xl0 proto tcp from any to any port = 23 flags S keep state

# Allow out FBSD CVSUP function
pass out quick on xl0 proto tcp from any to any port = 5999 flags S keep state

# Allow out ping to public Internet
pass out quick on xl0 proto icmp from any to any icmp-type 8 keep state

# Allow out whois for LAN PC to public Internet
pass out quick on xl0 proto tcp from any to any port = 43 flags S keep state

# Block and log only the first occurrence of everything
# else that’s trying to get out.
# This rule enforces the block all by default logic.
block out log first quick on xl0 all

#######################################################
# Interface facing Public Internet (Inbound Section)
# Interrogate packets originating from the public Internet
# destine for this gateway server or the private network.
#######################################################

# Block all inbound traffic from non-routable or reserved address spaces
block in quick on xl0 from 192.168.0.0/16 to any #RFC 1918 private IP
block in quick on xl0 from 172.16.0.0/12 to any #RFC 1918 private IP
block in quick on xl0 from 10.0.0.0/8 to any #RFC 1918 private IP
block in quick on xl0 from 127.0.0.0/8 to any #loopback
block in quick on xl0 from 0.0.0.0/8 to any #loopback
block in quick on xl0 from 169.254.0.0/16 to any #DHCP auto-config
block in quick on xl0 from 192.0.2.0/24 to any #reserved for docs
block in quick on xl0 from 204.152.64.0/23 to any #Sun cluster interconnect
block in quick on xl0 from 224.0.0.0/3 to any #Class D & E multicast

##### Block a bunch of different nasty things. ############
# That I do not want to see in the log

# Block frags
block in quick on xl0 all with frags

# Block short tcp packets
block in quick on xl0 proto tcp all with short

# block source routed packets
block in quick on xl0 all with opt lsrr
block in quick on xl0 all with opt ssrr

# Block nmap OS fingerprint attempts
# Log first occurrence of these so I can get their IP address
block in log first quick on xl0 proto tcp from any to any flags FUP

# Block anything with special options
block in quick on xl0 all with ipopts

# Block public pings
block in quick on xl0 proto icmp all icmp-type 8

# Block ident
block in quick on xl0 proto tcp from any to any port = 113

# Block all Netbios service. 137=name, 138=datagram, 139=session
# Netbios is MS/Windows sharing services.
# Block MS/Windows hosts2 name server requests 81
block in log first quick on xl0 proto tcp/udp from any to any port = 137
block in log first quick on xl0 proto tcp/udp from any to any port = 138
block in log first quick on xl0 proto tcp/udp from any to any port = 139
block in log first quick on xl0 proto tcp/udp from any to any port = 81

# Allow traffic in from ISP’s DHCP server. This rule must contain
# the IP address of your ISP’s DHCP server as it’s the only
# authorized source to send this packet type. Only necessary for
# cable or DSL configurations. This rule is not needed for
# ‘user ppp’ type connection to the public Internet.
# This is the same IP address you captured and
# used in the outbound section.
pass in quick on xl0 proto udp from z.z.z.z to any port = 68 keep state

# Allow in standard www function because I have apache server
pass in quick on xl0 proto tcp from any to any port = 80 flags S keep state

# Allow in non-secure Telnet session from public Internet
# labeled non-secure because ID/PW passed over public Internet as clear text.
# Delete this sample group if you do not have telnet server enabled.
#pass in quick on xl0 proto tcp from any to any port = 23 flags S keep state

# Allow in secure FTP, Telnet, and SCP from public Internet
# This function is using SSH (secure shell)
pass in quick on xl0 proto tcp from any to any port = 22 flags S keep state

# Block and log only first occurrence of all remaining traffic
# coming into the firewall. The logging of only the first
# occurrence stops a .denial of service. attack targeted
# at filling up your log file space.
# This rule enforces the block all by default logic.
block in log first quick on xl0 all
################### End of rules file ###########################

这是一个网上找的比较完善的ipf防火墙脚本范本

实际应用还得做一些小小的改动

比如网卡的设备号

防火墙的策略什么的

FreeBSD下启动时自动查盘的方法

跟linux一样
FreeBSD下也有隐含的参数可以在启动的时候做fsck -y的操作
这个开关就是fsck_y_enable
当你在/etc/rc.conf中设定
fsck_y_enable=”YES”
的时候
每次启动
都会做fsck -y xxxxxx的操作
这样就不会一发生严重错误就挂起等待手工干预

怎样让linux(redhat)的机器启动的时候强制查盘

linux机器非正常关机后重起的时候
都会自动修一下盘
当让严重的错误(serious problems)的时候
系统会挂起
等你手工修盘
这时我们多是
fsck -y /
……
这种系统挂起对于机器大多是托管在idc的公司来说
是无法忍受的
因为他们根本就没有人守在idc
其实,redhat的机器有些特殊的启动开关可以解决这个问题
linux2.4的机器(redhat7.x、redhat8.0、redhat9、as3)
系统里有个开关/fsckoptions
启动的时候会读这里面的内容当作参数传给命令fsck
这样我们就可以通过
echo “-y” > /fsckoptions
chattr +i /fsckoptions

这样的话
重起及其时系统就会自动fsck -y /dev/xxx
这相当于我们收容输入fsck /dev/xxx
然后当系统保有问题时,输入”y”
也就是自动查盘
考虑到每次当机、启动时候都会删掉文件/fsckoptions
所以需要用chattr +i将其变成不能被删除的

此法不能用在linux2.6(fedora 2、fedora 3、fedora 4、as4等)环境下
因为linux2.6下的fsck程序不支持同时用参数-p -a
跟上面的道理相同
linux2.6下可以用另一个开关/forcefsck
touch /forcefsck
chattr +i /forcefsck

这样启动的时候就会fsck -f /dev/xxxx

这两个开关不影响在/etc/fstab里定义为启动时不fsck的分区