Categories
Linux/Unix

CentOS/RHEL 5 中 Samba 服务无法访问

新安装的 CentOS 6.3 的服务器使用原始 Samba 配置文件却无法正常工作,症状是:能够访问,但是进入目录提示没有权限。

尝试方法:

关闭 SELinux

vim /etc/sysconfig/selinux

改为如下:

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#       enforcing - SELinux security policy is enforced.
#       permissive - SELinux prints warnings instead of enforcing.
#       disabled - SELinux is fully disabled.
#SELINUX=enforcing
SELINUX=disable
#
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.
SELINUXTYPE=targeted
Categories
Linux/Unix Storage

Device Mapper Multipath Configuration

1. Setup Steps

1.1 install and load device mapper (not necessary in RHEL58)

a) install Device Mapper Multipath/DMMP

yum install device-mapper device-mapper-multipath

b) load and check device mapper and multipath modules

modprobe dm-multipath
modprobe dm-round-robin
lsmod | grep md

c) start the multipathd service

Categories
Linux/Unix

编译 64bit Linux Kernel 时报 genksyms 找不到

可以使用

$ make mrproper
$ make cloneconfig
$ make prepare-all

来解决。

不过如果报错:“/bin/sh: scripts/genksyms/genksyms: No such file or directory”,可以将 “make prepare-all” 改为 “make prepare scripts”。如下:

$ make mrproper
$ make cloneconfig
$ make prepare scripts

 

Categories
Linux/Unix

bash 中的双引号和单引号

a=3
echo "b=$a+2"     # 显示 b=3+2
echo 'b=$a+2'     # 显示 b=$a+2

在 bash 中,

单引号 可以保证引用区域内的文字不被转换,起到保护作用,一般可以用在显示 code 之类;
双引号 可以包含文字或者函数段。其中,反引号中的函数,$ 开头的变量和 \ 开头反转换的字符外,其他都是直接输出。

之所以用双引号,是因为在bash中的变量替换发生在双引号内,如果不用引号,bash会把它们解释为命令。

Categories
Linux/Unix

SSH/SCP 不用输入密码连接远程 Linux 主机

其实步骤很简单:

1)在本地主机生成密钥对

ssh-keygen -t rsa

再输入密钥时候,直接按回车,我们的目的是不用输入密码嘛。

这个命令生成一个密钥对:id_rsa(私钥文件)和 id_rsa.pub(公钥文件)。默认被保存在 ~/.ssh/ 目录下。

2)将公钥添加到远程主机的 authorized_keys 文件中
SSH 到登陆到远程主机,将公钥追加到 authorized_keys 文件中

Categories
Linux/Unix

Enable Code Highlight in VIM on AIX / AIX 中开启语法高亮

Code highlight is disabled by default while you installed VIM in AIX. The root cause is default installation doesn’t create the .vimrc file. You can follow below steps to enable it.

  1. Add “export TERM=aixterm” to “.profile” in your home directory.
  2. Copy “$VIMRUNTIME/vimrc_example.vim” to “$HOME/.vimrc”.

In my system, my $VIMRUNTIME is “/opt/freeware/share/vim/vim63/” and my Home directory is “/”. And the item 1 is optional.

Categories
Excel

破解 Excel 密码的宏

破解 Excel 密码的宏:

Sub PasswordBreaker()
  Dim i As Integer, j As Integer, k As Integer
  Dim l As Integer, m As Integer, n As Integer
  Dim i1 As Integer, i2 As Integer, i3 As Integer
  Dim i4 As Integer, i5 As Integer, i6 As Integer
  On Error Resume Next
  For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
  For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
  For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
  For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
  ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
  Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
  Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
  If ActiveSheet.ProtectContents = False Then
  MsgBox "One usable password is " & Chr(i) & Chr(j) & _
  Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
  Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
  ActiveWorkbook.Sheets(1).Select
  Range("a1").FormulaR1C1 = Chr(i) & Chr(j) & _
  Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
  Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
  Exit Sub
  End If
  Next: Next: Next: Next: Next: Next
  Next: Next: Next: Next: Next: Next
End Sub
Categories
Windows Phone

【解决方法】无法连接到手机。请断开连接,重新启动手机,然后重试连接。Can’t connect to your phone. Disconnect it, Restart it, then try connecting again. Zune & Windows Phone

无奈于等 DFT 的 Tango 系统,刷了 XDA 下载的新 Dynamics7 的 Trophy ROM。完成后 Zune 一直报错。

错误提示“无法连接到手机。请断开连接,重新启动手机,然后重试连接。” 网上搜索得知也是个普遍性的问题,主要由于 Zune 与 Windows Phone 的证书问题。

最后尝试成功的解决方法如下。

  1. 断开手机,关闭 Zune。
  2. 在系统盘中找到“Microsoft\Crypto\RSA”文件夹,将其下级“S-x-x-xx-xxxxxxxxxxx”目录哦给删除。当然不放心的可以以重命名方式做备份。WinXP 在 “C:\Documents and Settings\【用户名】\Application Data\Microsoft\Crypto\RSA”下。Win7 在 “C:\Users\【用户名】\AppData\Roaming\Microsoft\Crypto\RSA”下。可以在更目录搜索得到。
  3. 之后重启 Zune 并连接手机。这时就能发现手机重新连接成功了。
Categories
Linux/Unix

为 CentOS 打上 EPEL 扩展源

最近想在 CentOS 上安装 wine,却发现在默认的 repo 里边没有。一番搜索后得知 CentOS 的源中没有 wine, 另辟蹊径的方法是安装 EPEL。那什么事 EPEL 呢,官方的答案是 Extra Packages for Enterprise Linux,也就是为企业级 Linux 提供的额外软件源,兼容 RHEL,CentOS,Scientific Linux。

安装方法如下:

For EL5 32位:

su -c ‘rpm -Uvh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm’

su -c ‘yum install foo’

Categories
Linux/Unix

CentOS 上安装 Testlink

系统为 CentOS 6.2 x86_64。Testlink:1.9.3。

1. 安装 mysql:

yum mysql mysql-server。

2. 安装 php:

yum php php-mysql php-gd php-ldap

3. 配置自启动:

chkconfig mysql on

chkconfig httpd on