Wednesday, December 31, 2008

rxvt-unicode下的字体配置问题

对gentoo不熟悉, 搞起来有点难度!
rxvt-unicode安装后, 使用如下字体:
URxvt.font:xft:Bitstream Vera Sans Mono:size=16

出现如下问题:
urxvt: unable to load base fontset, please specify a valid one using -fn, aborting.

google了一把都没有找到问题的基本!

刚刚了解了X的字体后, 知道x有两套字体机制.随便看了一下rxvt-unicode的编译选项:
USE="perl -afterimage -iso14755 -truetype"

原来是没有编译truetype字体支持!Bitstream Vera Sans Mono字体是使用xft机制的!此机制就是使用truetype字体的基本!

重新编译rxvt-unicode:
# USE="truetype" emerge rxvt-unicode

nice!!! 漂亮的字体出现了!!!!

find命令中maxdepth和prune

找指定深度的目录:

find / -maxdepth 2 -name "fonts"

在找查文件时, exclude指定目录:

find / -path "/usr/portage" -prune -o -name "fonts"
* 不包括/usr/portage文件夹

scim的配置

一堆为什么都有从使用gentoo开始!!
language, scim可以使用三个环境变量
* LANG
* LC_ALL
* LC_CTPYE
scim对LC_CTYPE变量的使用说明:Set this variable if you do not want to change your UI
前面两个都要影响到UI和字体, 第三个就是最好的选择了

scim官方的配置文档:
* http://www.scim-im.org/wiki/documentation/installation_and_configuration/all/system_configuration

上面的配置文档提到了scim使用的两种输入系统:
1. xim输入系统
2. im-module输入系统

xim是X服务器提供的一种输入系统, 比较有年份, 上面的文档说到这种输入系统在使用时会有些问题. 比如程序freeze等等

新的输入系统就是scim的im-module特性. 文档中提到了, scim的im-module在GTK环境下是默认安装im-module的, 但是在QT环境下, 需要安装不同的包:scim-qtimm, 下面是QT环境的问题:
The Qt im-module support is experimental right now and the qt-immodule patch is not included in most Linux distributions. If you can not find a Qt with im-module support built-in for your favorite distribution, chances are that you have to setup your Qt to work with XIM (like other X based apps). In that case, XMODIFIERS must be setup correctly for any KDE/Qt apps to work with SCIM.

什么是locale? 有什么作用?

使用gentoo就要多问几个为什么!
决定搞明白它!

之前只知道LC_*这堆环境变量的作用. 没有理会什么是locale.

什么是locale呢?

先看一下实体文件吧:

jessinio@nio-laptop ~ $ ls /usr/share/locale/zh_CN/LC_MESSAGES/
FvwmScript.mo cracklib.mo gtk20.mo sed.mo
FvwmTaskBar.mo findutils.mo libc.mo shadow.mo
GConf2.mo flex.mo libwnck.mo shared-mime-info.mo
Linux-PAM.mo fvwm.mo make.mo subversion.mo
atk10.mo gettext-runtime.mo nano.mo tar.mo
compiz.mo gettext-tools.mo popt.mo texinfo.mo
coreutils.mo glib20.mo scim-pinyin.mo wget.mo
cpio.mo gtk20-properties.mo scim.mo

一堆*.mo文件! *.mo和*.po文件就见得多了,i18n的产品!
先看一个*.po例子文件吧:

msgid "size not available"
msgstr "不被允许的大小"
msgid "Text%(sz)s"
msgstr "文本大小为 %(sz)s"

上面就是*.po文件的东西, 说白了:
*.po就是翻译对照表!!!!!
而*.mo就是*.po的二进制格式!! 从*.po文件生成*.mo可以使用msgfmt命令!

引用网上的一段话:

locale,说白了就是储存在glibc中的一些跟国家,地区有关的数据信息。比如说语言,货币,时间,输入法等等。在安装glibc的时候,它就会自动被安装在系统中。当程序需要的时候,它就会通过几个环境变量的设置,而选取不同的数据进行使用。这些数据被安装在 /usr/share/locale (X使用的被装在/usr/X11R6/lib/locale/)

在维基百科中可以看到如下信息:

These settings usually include the following display (output) format settings:

  • Display language setting
  • Number formats setting
  • Date/Time formats setting
  • Timezone setting
  • Daylight saving time (DST) setting
  • Currency formats setting

程序是怎么使用不用的locale的呢? 答案在于环境变量!

就是那一堆LC_*的变量

变量名 说明
LANG 一次性定义全部locale设置,但是允许通过下面的LC_*设置进一步作单项定制。
LC_COLLATE 定义字符串的字母排序方式。例如这会影响目录列表的分类显示。
LC_CTYPE 定义系统的字符处理性能。这决定哪些字符能被视为字母、数字,等等。这个变量如果生效还决定所使用的字符集。
LC_MESSAGES 使用基于消息机制的本地化方式的应用程序的本地化信息(绝大多数GNU程序皆属此类,请看下面的章节以获知如何让支持以及不支持此机制的程序本地化)。
LC_MONETARY 定义货币单位和货币型数值的格式。
LC_NUMERIC 定义非货币型数值的格式。影响到千位分隔符和小数分隔符等。
LC_TIME 定义日期和时间的格式。
LC_PAPER 定义默认的纸张尺寸。
LC_ALL 一个用于覆盖所有其它设置的特殊变量。

上面N多个变量都是定制本地信息的,其实常用的只有两个:
1. LC_CTYPE
这会影响到(X)程序对字符的处理, 比如scim, 如下是scim对此变量的使用说明:Set this variable if you do not want to change your UI language, scim可以使用三个环境变量
* LANG
* LC_ALL
* LC_CTPYE
前面两个都要影响到UI和字体, 第三个就是最好的选择了

2. LC_MESSAGES 这会影响到X程序的界面与它使用的字体

Tuesday, December 30, 2008

apache的目录索引(index)的编码问题

平时为了方便, 一般都是如下配置一个文件夹的索引:

alias /devres "/uss/www/doc.rdev/devres/"

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all



现在有一个问题, 就是apache默认把这种行为设置为iso-8859-1

如下为得到的信息(使用dog程序):

HTTP/1.1 301 Moved Permanently
Date: Wed, 31 Dec 2008 01:42:44 GMT
Server: Apache/2.2.8 (FreeBSD) mod_ssl/2.2.8 OpenSSL/0.9.8e DAV/2 SVN/1.4.6
Location: http://doc.rdev.kingsoft.net/share/media/
Content-Length: 249
Connection: close
Content-Type: text/html; charset=iso-8859-1

为了使apache在进行index时使用UTF-8编码, 增加下面的选项:
IndexOptions Charset=UTF-8

OK! 工作完成!

Wednesday, December 24, 2008

libc与glibc

linux libc可以说是glibc的历史分支!

后面因为glibc的优异, linux libc的开发者停止了linux libc的开发而釆用了glibc, 现在, linux libc几乎不使用了.



两者的历史:
1 http://en.wikipedia.org/wiki/GNU_C_Library
2. http://www.fsfe.org/en/fellows/ciaran/ciaran_s_free_software_notes/history_of_glibc_and_linux_libc

Monday, December 22, 2008

mailman的BCC需要审核问题

工作需要架一个maillist, 发现, 在用户BCC一份email到list里时, 列表的管理员(当然是我了)会收到一份审核信.

实在是那个烦!

查了一把, 原来是FAQ
* 原URL: http://wiki.list.org/pages/viewpage.action?pageId=4030676

virtualbox的NAT配置

工作需要, 要在服务器(ubuntu)下跑到个VM, 只要是linux不同的发行版本.

安装了一个virtualbox, 结果有一需求:
* 用户要指直login到虚拟机中

查了一把, 发现virtualbox主要有两种方式:
1. NAT转发
2. 搞个net-bridge, 这时, virtualbox有独立的IP

想了下, NAT转发比较easy. 就决定上这个( 没有需求一般是偷懒 )

本人一直深深知道服务器上, command才是王道, 所以, 主角是:
* VBoxManage命令!

sudo VBoxManage setextradata fedaro6 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/HostPort" 2222

sudo VBoxManage setextradata fedaro6 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/GuestPort" 22

sudo VBoxManage setextradata fedaro6 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/Protocol" TCP


查看一个VM被设置了哪些

jessinio@ubuntu-test-1:~$ sudo VBoxManage getextradata fedaro6 enumerate

VirtualBox Command Line Management Interface Version 2.0.2
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Key: GUI/SaveMountedAtRuntime, Value: yes
Key: GUI/LastCloseAction, Value: powerOff
Key: GUI/LastWindowPostion, Value: 390,147,720,532
Key: GUI/Fullscreen, Value: off
Key: GUI/Seamless, Value: off
Key: GUI/AutoresizeGuest, Value: on
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/HostPort, Value: 2223
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/Protocol, Value: TCP
Key: VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/GuestPort, Value: 22

如果想remove上面的某条配置, 可以使用

sudo VBoxManage setextradata fedaro6 "VBoxInternal/Devices/pcnet/0/LUN#0/Config/SSH/Protocol"
* 注意: 删除是等于set一个空值!

没有图形界面地启动VM:

sudo VBoxManage startvm redhat8 -type vrdp

问题又来了, 发现使用上面的启动命令行, 不能启动多个无界面的VM, 看一下

00:00:00.086 VirtualBox 2.0.2 r36488 linux.x86 (Sep 12 2008 14:56:22) release log
00:00:00.086 Log opened 2008-12-22T08:52:50.986863000Z
00:00:00.086 OS Product: Linux
00:00:00.086 OS Release: 2.6.22-14-generic
00:00:00.086 OS Version: #1 SMP Sun Oct 14 23:05:12 GMT 2007
00:00:00.092 VRDP: TCP server failed to bind to port 3389. (VERR_NET_ADDRESS_IN_USE)
00:00:00.092 VRDP: TCP server closed.
00:00:00.092 VRDP: Failed to start VRDP-IN thread, rc = VERR_NET_ADDRESS_IN_USE
00:00:00.094 Failed to launch VRDP server (VERR_NET_ADDRESS_IN_USE), error message: 'VRDP server port 3389 is already in use'
00:00:00.094 ERROR [COM]: aRC=NS_ERROR_FAILURE (0x80004005) aIID={d5a1cbda-f5d7-4824-9afe-d640c94c7dcf} aComponent={Console} aText={VRDP server port 3389 is already in use} aWarning=false, preserve=false
00:00:00.103 Power up failed (vrc=VERR_NET_ADDRESS_IN_USE, hrc=NS_ERROR_FAILURE (0X80004005))


* 重点: 'VRDP server port 3389 is already in use'

原来, sudo VBoxManage startvm redhat8 -type vrdp是默认使用了3389端口的. google得到别一命令:
* sudo VBoxVRDP -startvm redhat8 -vrdpport 3391

此命令可以指定port的. OK, 满足工作需求, 先这样吧

* 注意, 对Guest进行这些设置, 都是需要重启Guest的VM

加载iso文件

linux下和FreeBSD下加载iso文件的方法有点不同

linux下:
[root@jessinio-laptop ~]# mount -o loop /mnt/iso/CentOS-5.2-i386-bin-DVD/CentOS-5.2-i386-bin-DVD.iso /media

FreeBSD下:

mdconfig -a -t vnode -f /your/iso/image/5.3-RELEASE-i386-disc1.iso -u 0
mount -t cd9660 /dev/md0 /iso

Sunday, December 14, 2008

chmod和sticky位

上次那了关于set-user-ID, 这一次一起说linux下两个特殊的位:
1. set-user-ID
2. sticky bit
set-user-ID的作用这就不说了(上次写了), 说一下sticky的作用:

Sticky Bit-The Sticky Bit is only valid on directories. When the Sticky Bit is set on a directory, users are only allowed to delete files they own. Without this setting, users are allowed to delete files owned by other users as long as they have the write (w) permission on the directory. Special permissions are stored as part of the regular mode of the file, but there is no room for three more permission bits for these permissions. Because of this, special permissions are actually included within the execute (x) bit of user, group and other permissions. Figure 3.13 and Figure 3.14 demonstrate how these permissions are displayed when the corresponding execute bit is set and not set, respectively.

* 意思就是有sticky位的文件只能被owner删除和rename.
* linux下不起作用.
* -_-! 写本文前, 不知道linux下是不行的. 无法往下写了! 下面就说chmod的使用吧

下面是linux下, 文件的permission的基本信息:









chmod有两种方式:
1. 使用字符串方式指定文件的权限
2. 使用数字方式指定文件的权限.

先提出两个常看权限问题:
1. 把文件的权限设置成owner可读写,group只读,other只读
1. 把文件的group权限修改为可读写

字符串的方式:
常用来修改文件其中的一组权限.(文件的权限分为三组)
数字的方式:
常用来一次设置文件的三组权限

使用字符串的方式去设置上面的第一个问题:
# chmod u=rw,g=r,o=r FileName
上面的方式中, 一次修改了文件的三组权限.
使用数据的方式去设置:
# chmod 0644 FileName

看起来, 都可以完成. 其实, 字符串的方式比较麻烦, 数字的方式比较精炼.

重点在第二个问题!对于第二个问题如下方法:
# chmod g+w FileName

这只能使用字符串的方式, 如可要使用数字的方式, 需要有逻辑介入

所为, 字符串的方式重点在于修改文件的一组权限.而字符串的方式重点在于设定文件的三组权限

字符串的方式还有一种用法:
1. -X(大写) 如果文件或目录指定的一组权限有x位, 就去掉, 没有就保留原状
2. +X(大写) 如果目录指定的一组权限没有x位,就增加, 有就保留原状, 对正规文件不起作用

下面是man手册中chmod使用八进制方式表达:
A numeric mode is from one to four octal digits (0-7), derived by
adding up the bits with values 4, 2, and 1. Omitted digits are assumed
to be leading zeros. The first digit selects the set user ID (4) and
set group ID (2) and restricted deletion or sticky (1) attributes. The
second digit selects permissions for the user who owns the file: read
(4), write (2), and execute (1); the third selects permissions for
other users in the file's group, with the same values; and the fourth
for other users not in the file's group, with the same values.

数字的方式没有其它的特点了吗? 也不是的, 至少sticky位只能使用数字的方式. 如下:
set-user-ID和sticky位的情况比较特殊:
* set-user-ID只有user和group两种情况, 没有other的情况
* 对于sticky位只有一种情况:有与没有.
那么, 就算这两种情况都出现, 刚好为 4+2+1=7

如: chmod 7755 file

珠海一日徒步

今天的大概步印如下图:
















最无语的是板樟山的隧道没有人行道, 两个无畏的年轻人决定爬山翻过山脉, 结果........ 太过有难度的山路在前面等着.... 又想起<<into the wild >>电影的悲惨结果..... 只好原路返回!!!!! 不过, 山上的景色很好..... 特别是山泉水.

Saturday, December 13, 2008

关于set-user-ID位

今天, 有人问我:为什么一般用户可以在X环境下, 可以把机器给关了, 但是在console下就要使用root权限.

其实, 这个问题很简单的. 一个很常看的例子就是sudo程序了. 看看吧:

jessinio@jessinio-laptop:/tmp$ ls -l $(which sudo)
-rwsr-xr-x 2 root root 115136 2008-09-01 21:17 /usr/bin/sudo

两个特点:
1. sudo的拥有者为root
2. 有一个"s"位

什么是"s"位, 它又有什么作用的呢?

"s"位就是"set-user-ID"的意思, 作用就是让其它用户运行有"s"位的程序时都可以等于程序的拥用者运行此程序一样.

就如sudo的例子, jessinio用户可以sudo时, 可以等于root(sudo程序的拥有者)运行一样.(这里不谈与sudo与sudoers文件的关系)

set-user-ID的得到是从chmod(system call)得到的.如:

jessinio@jessinio-laptop:/tmp$ sudo chmod u+s wrapper.o

这里有两个问题:
1. 对脚本文件不起作用(原理后面解释)
2. symbolic links文件不起作用

对于脚本的问题, 由于脚本是被解释器运行的, 如果解释器没有set-user-ID位的话, 脚本文件有set-user-ID位也没有意思

比如:readme.txt有set-user-ID, 使用vim编辑这个文件也不行使vim进程有root权限的

对于symbolic links的问题, 在chmod的man手册中就说清楚了:

chmod never changes the permissions of symbolic links; the chmod system call cannot
change their permissions. This is not a problem since the permissions of symbolic links
are never used. However, for each symbolic link listed on the command line, chmod
changes the permissions of the pointed-to file. In contrast, chmod ignores symbolic
links encountered during recursive directory traversals.

上面的是linux的chmod的man手册.

但是在FreeBSD中, chmod是可以使用"-h"参数去令chmod程序去修改文件的权限(当然有set-user-ID), 但是, 还是不起作用的, 因为对于unix/linux系统来说, symbolic links文件的permissions是被忽略的

问题又来了, 对于写脚本的人来说, 怎么利用上set-user-ID呢?

答案是使用编译型语言写wrapper

简单的例子如下:

#include
int main (int argc, char ** argv) {

int err;
char *newenv[] = { NULL };

if ((err = execle("./runfile.py", "pauseme", NULL, newenv)) < 0 ) {
exit(err);
}

return 0; // never reached!
}

其中, runfile.py就是这个目标wraper程序要去调用的脚本程序. 这样, 当wrapper程序有set-user-ID位的情况下, runfile.py脚本就会被set-user-ID用户去调用, 就是等于有set-user-ID位了^_^


上面的wrapper.c文件的处理方法:

jessinio@jessinio-laptop:/tmp$ gcc wrapper.c -o wrapper.o
jessinio@jessinio-laptop:/tmp$ sudo chmod root:root wrapper.o
jessinio@jessinio-laptop:/tmp$ sudo chmod u+s wrapper.o

注意: 每次使用chmod设置permissions后, set-user-ID都会被去掉的.可以重新设置它

Thursday, December 11, 2008

FreeBSD下的mysql配置

FreeBSD下的mysql在install后, 在/etc/rc.conf中增加:

mysql_enable="YES"

启动mysql_server

ps auxwww|grep mysql

可以看到两个重要参数:
1. my.ini文件的位置
2. db文件的位置

在linux( centOS )下只可以看到db文件的位置. 因为my.ini默认去/etc/my.ini找.

一般需要做如下设置:
1. 指定mysql的编码(my.cnf)
2. 把db文件指到其它地方

实际上, my.cnf是放在db文件夹内的.(可以从rc脚本中看到)


1. 配置/etc/rc.conf

查看rc脚本中的变量, 可以在/etc/rc.conf加入一个参数:
mysql_dbdir="/path/to/database"

使用utf-8编码:

在my.ini中的[mysqld一节中增加:
character_set_server=utf8

urxvt的配置

常有人问: 有了gnome-terminal, konsole, 为什么还使用古董级的rxvt呢?

其实, rxvt满足了我一个要求: 使用screen时可以使用滚动条(mouse和touchpad的)

我的rxvt没有什么配置, 只是之前在gnome-terminal的theme

!real transparent
URxvt.background:rgba:0000/0000/0000/E000
URxvt.depth:32

URxvt.colorBD:yellow
URxvt.colorUL:green
URxvt.multichar_encoding:utf-8
URxvt.scrollBar:Fault
URxvt.scrollBar_right:True
URxvt.scrollBar_floating: True
URxvt.scrollstyle: next
URxvt.saveLines:10000

!color scheme
URxvt.foreground:#27CF38
URxvt.color0:black
URxvt.color1:#AA0000
URxvt.color2:#6C93F2
URxvt.color3:#AA5500
URxvt.color4:#DED03A
URxvt.color5:#AA00AA
URxvt.color6:#00AAAA
URxvt.color7:#AAAAAA
URxvt.color8:#555555
URxvt.color9:#FF5555
URxvt.color10:#55FF55
URxvt.color11:#FFFF55
URxvt.color12:#5555FF
URxvt.color13:#FF55FF
URxvt.color14:#55FFFF
URxvt.color15:#FFFFFF

!fonts setting
URxvt.font:xft:Monospace:size=16

由newsyslog引发的问题之一: apache的reload

一直很喜欢nginx的reload, 实际上就是sighup, 如:

kill -HUP $(cat /var/run/nginx.pid)

在apache的rc脚本中, 是使用这种方法:

httpd -DNOHTTPACCEPT -k graceful

但是, 本文都是newsyslog引发的问题, newsyslog要求什么呢?

newsyslog需要使用signal去使其它程序(如apache等)reload, 上apache的rc脚本中, 看不到signal.

google了一把, 找到以下好信息

* reload - same as 'apachectl graceful' (sends USR1 signal)
* restart - same as 'apachectl restart' (sends HUP signal)
* reload-modules - same as stop + start

Monday, December 1, 2008

网络分析工具的工作原理

有些好怪网络公司的网站访问量统计分析工具的基本原理

在一时想不明的情况下, 注册了google公司的分析工具:

https://www.google.com/analytics/

在注册的过程看到以下一段文字:
Copy the following code block into every webpage you want to track immediately before the tag

哈哈, 还没有看google提供的javascript脚本, 已经知道基本原理了.

在自己的页面上增加一段google的analytics文件, 这就可以让analytics知道不少基本信息了, 如果有空再看一下google analytics提供的javascipt脚本吧

Friday, November 28, 2008

gnome真有GNU的味道

早有感觉得gnome有GNU的味道了, 只是当时没有写下自己的感觉, 现在写一下.

首先说一下, 什么是gnome?

从下面的URL中得到: http://developer.gnome.org/doc/GGAD/z2.html

"Gnome" is actually an acronym: GNU Network Object Model Environment.

现在同事提了一下, 使用命令行自动化去设置屏幕的亮度

gconftool-2 --type int --set /apps/gnome-power-manager/backlight/brightness_ac 68

思想歪了一下, 想出了一个歪主意: 动态换桌面

gconftool-2 --type string --set /desktop/gnome/background/picture_filename /home/jessinio/Pictures/11390-fullsize.jpg

哈哈哈

这就是GNU的味道!!!

Tuesday, November 25, 2008

linux下的防火墙

新同事是使用openSuSe的, 他的notebook不能被其它机器ssh.

ps了一下, 是有sshd的. 问题早些时候碰到过, 所以认定是firewall的问题.

快速解决问题是google!
sudo /sbin/rcSuSEfirewall2 stop

如果没有google呢? 还是找出一条通用的路比较好!

现在有两个环境:
1. ubuntu中安装firestarter
2. opensuse中使用默认的firewall

在没有启动firewall的情况下, 使用lsmod:

结果是iptable_filter的被引用为0次.

在启动firewall后, 它的引用次数为1

引用iptable_filter的Mod都为这两个firewall程序的(使用modinfo)

Sunday, November 23, 2008

nagios笔记

nagios的配置文件如下图结构:

1. main config file

用于配置nagios daemon和cgi程序, 用处如下:
* 指定其它配置文件(resource, object define file, temp, log等等.
* nagios启动参数.

1. resource file
* 用户定义的marco文件. 比如$USER1$
* 在main config file中通过resource_file标志引入使用

1. object definition file
* 定义使用的一切object
* 在main config file中, 通过cfg_file, cfg_dir标志引入使用

1. cgi configure file
* 配置cgi服务脚本的: html路径, 认证

开始时最先要学会的就是objecet的定义.

关于"object"的解释:
1. host
* 为网络上的物理设置
* 有一个(以上)的地址, 如IP, mac地址
* host有父与子的关系.

1. services, services是必须与host关联
* 为host的一个属性, 如CPU, disk
* 为host所提供的一种服务, 如: POP3, HTTP, SSH等
* 其它与host相关的, 如:DNS record, 等.

1. contact
* 定义出问题时将通知的人员列表

1. timeperiods
* 定义host与services被监控的时段
* 定义重复通知contact的间隔

1. command
* 定义host和services被监控时调用的程序与脚本
* 通知
* 事件处理器
* and more

关于object类中的各种属性的使用, 可以查看nagios的手册Object Definitions一节

chmod中的X选项使用

在ubuntu中的chmod man手册中, 没有提到chmod的详细使用说明.

下面是在FreeBSD中看到的:

X The execute/search bits if the file is a directory or any
of the execute/search bits are set in the original (unmodi-
fied) mode. Operations with the perm symbol ``X'' are only
meaningful in conjunction with the op symbol ``+'', and are
ignored in all other cases.

从面里可以知道一个信息:
* 只有-/+X, 没有=X

看一个例子:
# chmod -R =rw,+X /tmp/test

那么, +X使用后起什么作用呢?

表现起下面的功能:
1. -X(大写) 如果文件或目录指定的一组权限有x位, 就去掉, 没有就保留原状
2. +X(大写) 如果目录指定的一组权限没有x位,就增加, 有就保留原状, 对正规文件不起作用

Thursday, November 20, 2008

[工作] snmpd的安装

ubuntu server默认有snmpd, 无需要安装.

发现运行snmpd后, 无法snmpwalk和snmpget到信息. 但是在本地又可以(localhost)

于是看一下端口:
# sudo netstat -nap |grep snmp
只有:
127.0.0.1:161
被监听.

google一把"snmpd listen ip address", 真的有信息

原来是snmpd程序的一个参数指定的, 如"-a"

于是在/etc/snmp/snmpd.conf中加入:

agentaddress 192.168.48.141

问题解决.

google好用. BS baidu.com

[生活] blogspot.com被封, 顶China个肺

无言!

blogger.com这么好用, 被封, 不骂一下China, 对不住自己.

"共抢党" 很好, 很强大!!!!!

Wednesday, November 19, 2008

[工作] linux and volume

查看磁盘的分区情况:
# sudo fdisk -l

格式化分区:
# sudo mkfs.ext3 /dev/sdb6

得到分区的uuid号:
# sudo vol_id /dev/sdb6

增加uuid到fstab中

mount加新的分区:
# sudo mount -a

竟然出错!! 报:
/dev/disk/by-uuid/xxxxxxxx (uuid号码)

google说要reboot, 没理由吧, 这不是linux的风格, 经好友推介如下两命令:

# sudo blkid
# sudo udevtrigger


再次
# mount -a
ok

Saturday, November 8, 2008

[生活] 立冬, 终于有寒意

早上起床跑步, 发觉气温下降.

回忆, 冬天一年比一年来得晚, 时下已经是11月份

查月历, 原来今天是"立冬".

又一年了, 想当初来珠海时, 也是11月份. 流浪到珠海. 怀着梦想. 努力工作, 学习.

总结一下, 工作一年还是有不少收获的. 期待明年有更好的表现.

应该找回当初刚毕业时的冲动:
* 人生苦短, 高调生活 ( 想是想高调, 有时高调不起来 )

Thursday, November 6, 2008

[生活] 原来自己老了

还不会老吧? 自己一直这样想的, 刚出社会一年嘛, 郁闷!
今天看新闻, 得知一网站: http://www.360quan.com

随便点了几个blog, e........, 绝对是90后! 风格与自己的截然不同.

突然想到一个字: 老

再过几年, 会变成什么样呢?

Wednesday, November 5, 2008

决定来google安家

太久没有写blog了, 好像很多东西被遗忘了.

之前友人的空间过期了, 又不想使用国内的blog系统

突然想到google的blog, 还在看它的API( 这是google产品的一大特点: 开放性 )