2009年7月13日 星期一

freebsd 安裝 bash

真神奇居然預設沒有安裝bash....

1.
安裝 bash

# cd /usr/ports/shells/bash
# make install clean


2.
shell 改成 bash

# chsh <==
這個指令就是 change shell 的意思
#Changing user database information for root.
Login: root
Password:
Uid [#]: 0
Gid [# or name]: 0
Change [month day year]:
Expire [month day year]: Class: Home directory: /root
Shell: /bin/tcsh <==
/bin/tcsh 改成 /usr/local/bin/bash
Full Name: Charlie &
Office Location: Office Phone: Home Phone: Other information:
3.
存檔離開
4.
編輯 bash 設定檔
# vi /etc/profile
加入 export LANG=zh_TW.Big5 #設定繁體中文 export LC_ALL=zh_TW.Big5 #設定繁體中文
alias ls='ls -fGa' #
ls 能顯現出顏色
alias rm='rm -i' #
刪除確認 alias cp='cp -i' # 拷貝確認
alias mv='mv -i' #
搬移確認
5.
自訂命令提示字元 PS1="[\u@\h \W]\\$ " 說明: \u --> 顯示使用者帳號
\h -->
顯示系統的 hostname
\w -->
完整路徑
\$ -->
# 表示 root, $ 表示一般使用者

6.
存檔離開,重新登入即可生效...

2009年7月8日 星期三

rebuild freebsd soft raid

(2) 如果 mirror 中某一個硬碟壞掉了,怎麼辦?

# gmirror remove gm0 ad0    # 移除 mirror 壞掉的 ad0

# gmirror forget gm0   # 忽略 mirror 中之前存在,而現在不存在的裝置

# shutdown -h now      # 關機拔掉壞掉那棵 HD 假設壞掉的是 ad0 更換新的 HD 接著重開 gm0 就會使用 ad1 進入 OS 可看看是否正常運作

# shutdown -h now    # 再次關機接上新的硬碟

# gmirror insert gm0 /dev/ad0     # 重開後再 insert 新的硬碟

 

http://freebsd.ntut.idv.tw/document/freebsd_software_raid_geom.html

 

2009年7月6日 星期一

ProFTPd quick intallation

ProFTPdbsdports裡面就有的一個ftpd

所以想安裝的請到/usr/ports/ftp/proftpd

make install clean

就可以安裝了

 

然後請

cd /usr/local/etc

vi proftpd.conf

修改ServerName

使""內和你hostname顯示的相同

ServerType可選standalone或是inetd

然後請在檔案內加一行

ScoreboardFile /var/run/proftpd.scoreboard

加完之後

離開vi

touch /var/run/proftpd.scoreboard

 

然後應該就可以執行

/usr/local/etc/rc.d/proftpd.sh start

來啟動proftpd

 

然後就可以/usr/local/etc/rc.d/proftpd.sh status

來看proftpd有沒有執行

 

不過這樣設定的情況下 是不能匿名登入的

就剛開始的設定 使用者也不會被限制在他的家目錄

 

如果要開放匿名目錄

<Anonymous ~ftp>

</Anonymous>

前面的#去掉即可

看看要不要改什麼設定

 

根據上面的說明

#DefaultRoot ~

把這行前面的#去掉

就可以限制使用者只能在他的家目錄活動

 

官方網站

http://www.proftpd.org/

2009年7月5日 星期日

freebsd ftp script command

#!/bin/sh
#
# ftp script to send/get file automatically
#

# define the variables
filename1="/path1/filename1"
filename2="/path1/filename2"
hostname="ftp.domain_name.com"
username="username"
password="password"

# main
ftp -n $hostname <<EOF
quote USER $username
quote PASS $password
binary
put $filename1
get $filename2
quit
EOF