2012年1月12日 星期四

QNAP TS-412 自訂排程

1.安裝 cron, coreutilsipkg install cron
ipkg install coreutils

2.編輯 /opt/var/cron/cron.allow 內容如下admin
3.加入排程工作 /opt/bin/crontab -e 內容範例如下
*/1 * * * * date >> /tmp/crontab.test

2012年1月5日 星期四

HD SUPPORT TOOLS

1.安裝 hdsupp.lrp
apkg -i hdsupp.lrp

2.複製 MBR 至開機硬碟(/dev/sda)
dd if=/usr/sbin/mbr.bin of=/dev/sda bs=512 count=1

3.執行 syslinux 安裝 ldlinux.sys
syslinux /dev/sda1

2011年12月20日 星期二

QNAP TS-412 安裝 openssh

1.使用QPKG 外掛管理,安裝 Optware IPKG


2.安裝 openssh
ipkg update
ipkg install openssh

3.開機自動啟動 open sshd
修改 /etc/init.d/Optware.sh,尋找以下內容
case "$1" in
start)
...[elided]...
# adding Ipkg apps into system path ...
/bin/cat /etc/profile /bin/grep "PATH" /bin/grep "/opt/bin" 1>>/dev/null 2>>/dev/null
[ $? -ne 0 ] && /bin/echo "export PATH=$PATH":/opt/bin:/opt/sbin >> /etc/profile
;;
stop)

改為

case "$1" in
start)
...[elided]...
# adding Ipkg apps into system path ...
/bin/cat /etc/profile /bin/grep "PATH" /bin/grep "/opt/bin" 1>>/dev/null 2>>/dev/null
[ $? -ne 0 ] && /bin/echo "export PATH=$PATH":/opt/bin:/opt/sbin >> /etc/profile


# Patch per http://wiki.qnap.com/wiki/Install_Optware_IPKG
/bin/echo "Run Optware/ipkg /opt/etc/init.d/*"
source /etc/profile
# Start all init scripts in /opt/etc/init.d
# executing them in numerical order.
#
for i in /opt/etc/init.d/S??* ;do
# Ignore dangling symlinks (if any).
#[ ! -f "$i" ] && continue



case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
# End patch


;;
stop)

2011年11月16日 星期三

PXELinux 設定範例

/etc/xinetd.d/tftp
---------------------------------------------
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}

/etc/dhcpd.conf
-------------------------------------------
ddns-update-style none;
ignore client-updates;
allow booting;
allow bootp;
subnet 192.168.56.0 netmask 255.255.255.0 {
range 192.168.56.10 192.168.56.20;
option broadcast-address 192.10.0.255;
option routers 192.168.56.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.19.10;
next-server 192.168.56.101;
filename "linux-install/gpxelinux.0";
}

/tftpboot/linux-install/pxelinux.cfg/default
--------------------------------------------
DEFAULT menu.c32
PROMPT 0
ALLOWOPTIONS 0
TIMEOUT 50

LABEL linux
MENU LABEL LINUX
KERNEL vmlinuz
append initrd=initrd.img


LABEL local
kernel chain.c32
append hd0 0


LABEL dos
MENU LABEL DOS
kernel memdisk
append initrd=dos.img


LABEL memtest
MENU LABEL MEMTEST
kernel memdisk
append iso initrd=memtest86+-4.20.iso

2011年11月3日 星期四

PROXMOX新增WEB帳號


1.ssh login
2.add user
3.add user group id 0

2011年10月25日 星期二

XP命令列批次刪除空目錄

for /f %a IN ('dir /a:d /b') do rd "%a"

2011年9月14日 星期三

開啟 ZyXEL NSA 221 Telnet

1.安裝套件 PHP-MySQL-phpMyAdmin

2.啟用Web發行功能,將 public加入

3.啟用套件 PHP-MySQL-phpMyAdmin

4.編輯共用 public 勾選 將此共享發行至 Web

5.連線共用磁碟 net use * \\<ip>\public
新增檔案 getpasswd.php 內容如下
<?php
echo '<pre>
login:NsaRescueAngel
password:';

system('/sbin/makekey');
echo '</pre>';
?>

6.下列網址開啟 telnet 後門,帳號為:NsaRescueAngel
http://<ip>/zyxel/cgi-bin/remote_help-cgi?type=backdoor

7.下列網址取得密碼
http://<ip>/public/getpasswd.php