2014年10月27日 星期一

[Ubuntu]Thunderbird 中文化


1.Update the package index:
# sudo apt-get update
2.Install thunderbird-locale-zh-hant deb package:
# sudo apt-get install thunderbird-locale-zh-hant

[Linux]CrunchBang Linux

新增中文字體及輸入法
sudo apt-get update
sudo apt-get install ttf-wqy-microhei
sudo apt-get install ibus-chewing

im-config


桌面解析度設定
nano ~/.config/openbox/autostart

新增
xrandr --size 1600x768 &

sudo reboot

[ubuntu]Install TFTP Server


sudo apt-get install tftpd-hpa tftp-hpa

sudo gedit /etc/default/tftpd-hpa

####################
#Defaults for tftpd-hpa
TFTP_USERNAME="root"
TFTP_DIRECTORY="/home/takashi/tftpboot"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -s -c --secutre"

####################
PS:/home/takashi/tftpboot 需要自已新增目錄

sudo mkdir /home/takashi/tftpboot

sudo chmod 777 /home/takashi/tftpboot

sudo service tftpd-hpa start

在Ubuntu上面直接裝的TFTP server套件不會在開機時執行,精確一點說應該是開機時跑了卻沒有起來。
這是個老毛病,修一下就好。
編輯 /etc/init/tftpd-hpa.conf ,修改它錯誤的初始條件。

#start on runlevel [2345] # the original line which is wrong
start on (filesystem and net-device-up IFACE!=lo)

[Linux]Lubuntu install Xrdp



sudo apt-get install xrdp
echo 'lxsession' > .xsession
sudo apt-get install xvfb lxde
sudo service xrdp restart

[Linux] ubuntu install telnet service


ubuntu安装telnet服务
1. sudo apt-get install xinetd telnetd
sudo gedit /etc/inetd.conf并加入以下一行,假如没有发现这个文件,
自己新建立一个也是可以的.
 ------------------------------------------------------------------------------------------------------------
telnet stream tcp nowait telnetd /usr/sbin/tcpd /usr/sbin/in.telnetd
 ------------------------------------------------------------------------------------------------------------
3. sudo gedit /etc/xinetd.conf并加入以下内容:

------------------------------------------------------------------------------------------------------------
# Simple configuration file for xinetd
#
# Some defaults, and include /etc/xinetd.d/

defaults
{
# Please note that you need a log_type line to be able to use log_on_success
# and log_on_failure. The default is the following :
# log_type = SYSLOG daemon info
instances = 60
log_type = SYSLOG authpriv
log_on_success = HOST PID
log_on_failure = HOST
cps = 25 30
}
 ------------------------------------------------------------------------------------------------------------
4. sudo gedit /etc/xinetd.d/telnet并加入以下内容:

 ------------------------------------------------------------------------------------------------------------
# default: on
# description: The telnet server serves telnet sessions; it uses
# unencrypted username/password pairs for authentication.
service telnet
{
disable = no
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
} 
 ------------------------------------------------------------------------------------------------------------
5. 重启机器或重启网络服务 
sudo /etc/init.d/xinetd restart

[Linux]Pure-FTPD + pureadmin


Install ''Pure-FTPD'' with GUI

1. Install the pure-ftpd package and the pureadmin package from the Universe Repository.

sudo apt-get install pure-ftpd pureadmin  

2.新增虛擬使用者所要對應的系統使用者(ftpuser)與其家目錄
sudo adduser --system --home /home/ftpuser --shell /dev/null --disabled-password  --disabled-login ftpuser

3.新增虛擬使用者
sudo pure-pw useradd user01 -u ftpuser -d /home/ftpuser

如果要不同使用者有不同家目錄需在 -d 指定且新增其家目錄, 如
sudo mkdir /home/ftpuser/joe; sudo chown -R ftpuser /home/ftpuser/joe
sudo pure-pw useradd joe -u mis91 -d /home/ftpuser/joe
預設會新增在 /etc/pure-ftpd/pureftpd.passwd 中,或使用 pure-pw -f your.passwd.file 指定

4.建立 db 並確認 /etc/pure-ftpd/conf/PureDB 中資料為 /etc/pure-ftpd/pureftpd.pdb
sudo pure-pw mkdb /etc/pure-ftpd/pureftpd.pdb -f /etc/pure-ftpd/pureftpd.passwd

加入 DB 認証模式至設定中
sudo ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/45puredb

5.確認幾項設定
* 確認 cat /etc/pure-ftpd/conf/UnixAuthentication 中指有字串 no
* 確認 cat /etc/pure-ftpd/conf/MinUID 中的數值比 ftpuser 的 UID 還小(如: adduser --system 的 UID 通常會預設值) , 不然虛擬帳號無法登入

6.重新啟動 pure-ftpd service
sudo /etc/init.d/pure-ftpd restart

============================================================
其他常用到的幾個設定,檔案都需寫在 /etc/pure-ftpd/conf 下
* ) echo "yes" > ChrootEveryone (使用者被限制在家目錄下)
* ) echo "no" > PAMAuthentication (不使用 PAM 認証:一般用者無法用 pure-ftpd 登入)
*) echo ",9188" > Bind (設定 ip/port )
* ) echo "yes" > KeepAllFiles (這個應該是不允許用戶端刪除文件)
* ) echo "yes" >DontResolve (不解釋主機名,可以加快登錄速度)

設定允許 symbolic links :
1) 編輯 /etc/default/pure-ftpd-common
將 VIRTUALCHROOT=false 改為 VIRTUALCHROOT=true
2) Restart service

設定允許 匿名登入
1) echo "no" > /etc/pure-ftpd/conf/NoAnonymous
2) sudo adduser --system --home /home/ftpuser --shell /sbin/nologin --disabled-password  --disabled-login  ftp
3) Restart service

設定 Passive mode
1) echo "29799 29899" > /etc/pure-ftpd/conf/PassivePortRange

 設定最多 clients 數量
1) echo "50" > /etc/pure-ftpd/conf/MaxClientsNumber

[Linux]set ubuntu route default gw


方式1:

直接編輯網路連線檔案。

sudo gedit /etc/NetworkManager/system-connections/有線網路連線\ 1

#設定default gw的參數,false=設定gw,true=取消gw,

never-default=false


方式2:
編輯route
route
sudo route del default gw <gatway ip> eth0
sudo route add default gw <gatway ip> eth1

[Ubuntu] CPU Test


Linux CPU information by issue following command

#cat /proc/cpuinfo



You can install “cpuburn” in Ubuntu 12.04 Precise Pangolin, 11.10 Oneiric Ocelot, 11.04 Natty Narwhal, 10.10 and 10.04 by using the below command in your Terminal window.

#sudo apt-get install cpuburn

An example …

#burnP6

If you have multi-cores …

#burnP6 &

you can combine all those needed running instances into a single chain command as well. For instance, if I wanted to run 4 instances of ‘burnP6′ (without having to enter one after the other) then I can use it in the below format (note there’s a space between each ‘burnP6 &‘ command).

#burnP6 & burnP6 & burnP6 & burnP6 &

When you want to terminate them all, simply enter the below command.

#killall burnP6

You can read its manual by using the below command in your Terminal as well.

#man cpuburn

[Linux]Fix Lubuntu / Xubuntu 14.04 Network Manager Missing From The Panel



Lubuntu 14.04: fix 1


To fix the Network Manager not showing up on the panel issue, from the Lubuntu menu select Preferences > Default applications for LXSession, then click on the Autostart tab and under "Manual autostarted applications" type "nm-applet", then click the "+ Add" button on the left:

If the above solution didn't work for you in Lubuntu 14.04 or if you're using Xubuntu 14.04 and you're having this issue, here's another solution. Basically, the solution below is for those who must run "nm-applet" as root to get it to show up in the pane - we'll be using dbus-launch to launch nm-applet at startup.

To get the Network Manager applet to work properly in either Lubuntu 14.04 or Xubuntu 14.04, run the following command:
sudo sed -i 's/Exec=nm-applet/Exec=dbus-launch nm-applet/' /etc/xdg/autostart/nm-applet.desktop

[Linux]Ubuntu install NTP Server


1.執行下列指令安裝
sudo apt-get install ntp

2.修改ntp設定檔
sudo gedit /etc/ntp.conf

(1)找到  #statsdir /var/log/ntpstats

將 #字號拿掉 開啟紀錄功能

(2)設定外界NTP Server
找到
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

 設定你想使用的台灣區NTP伺服器,請選擇伺服器速度快且穩定的NTP伺服器,依據優先性設定0~3四個NTP伺服器

server tock.stdtime.gov.tw 
server tick.stdtime.gov.tw 
server time.stdtime.gov.tw 
server clock.stdtime.gov.tw

3.修改要廣播更新時間的子網段,假設我的網段是192.168.2.0/24
可於設定檔找到下列說明 

# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

broadcast 192.168.168.255

4.重新啟動NTP服務 

 sudo service ntp restart

5.檢查NTP服務是否同步

sudo ntpq -c lpeer

執行後會出現步驟2.設定的網域對應的IP資料與

6.檢查NTP服務同步紀錄檔是否正常寫入

sudo tail -f /var/log/syslog

7.記得檢查UDP 123 port是否開啟
iptables -A OUTPUT -p udp --dport 123 -j ACCEPT 
iptables -A INPUT -p udp --dport 123 -j ACCEPT

[Ubuntu]Create VLAN in Ubuntu Linux


1. Install the vlan package using apt-get tool

· sudo apt-get install vlan

2. Load the Vlan (802.1q) module

· modprobe 8021q
· echo 8021q >> /etc/modules

3. Add vlan interface by using ‘vconfig add [interface-name] [vlan_id]‘ command syntax

· vconfig add eth0 188
· ifconfig eth0.188 192.168.188.100 netmask 255.255.255.0
· sudo gedit /etc/network/interfaces 

· auto eth0.188
· iface eth0.188 inet static
· address 192.168.188.100
· netmask 255.255.255.0
· vlan-raw-device eth0

 

 

4. Remove Vlan interface

· vconfig rem eth0.188

[Game] Rimworld enable Dev mode (for Mac)

In Finder Press Command+Shift+Dot to open hidden folder /Users/[user name]/Library/Application Support/RimWorld/Config/DevModeDisable Dele...