Thursday, December 06, 2012

Add static route in windows

Add static route in windows:

 1. shows routing table

 netstat -nr

 2. permanent add connecting to 172.17.0.0 through 172.17.32.1 gateway with the lower priority 2

 route -p add 172.17.0.0 mask 255.255.0.0 172.17.32.1 metric 2


Tuesday, April 12, 2011

blocking application in winXP

1. Start->Run->secpol.msc 

2. Expand software restriction policies
Right click Additional rules-> New Path Rule
Path: C:\Program Files\Outlook Express\msimn.exe
Security Level: Disallowed
Click OK

Monday, October 11, 2010

Manage Windows7 SEP client with SEP 11 SEM

1.) Clients don't appear in the SEM console
a. Delete %programfiles%\Common Files\Symantec Shared\HWID\sephwid.xml
b. Open the registry and navigate to HKLM\Software\Symantec\Symantec Endpoint Protection\SMC\Sylink\Sylnk
c. Edit the "HardwareID" value data to be blank
d. Restart the client workstation or Symantec Management Client (SMC) service in the services snap-in.

refer: http://www.symantec.com/business/support/index?page=content&id=TECH102815&locale=en_US

Wednesday, March 24, 2010

sed & awk

Split the line with field separator ".", and restructuring again
awk -F. '/stbdbp/{ print $2"."$3"."$4"."$5".Z"}' ./list.txt
 
Insert "go" to the next of every lines from test_new.log
sed '1,$ {
        a\
go
}' test_new.log
 
Remove the line which contains "#" from test_new.log
sed '/#/d' test_new.log
 
Remove blank line from test_new.log
sed '/^[ ]*$/d' test_new.log

Monday, June 08, 2009

solaris 10 with Storage 3320

#sccli
>show lun
>show channel
>show logical-drive
>show partition

Thursday, November 06, 2008

error log, enable tty console

errlogter (test the errpt)
/usr/lib/errdemon (errpt demon)
alog -o -t console (show console message)

smitty tty

Friday, October 24, 2008

check memory info. in AIX

# bootinfo -r

# svmon -G (use 4K block to count)
size inuse free pin virtual
memory 1048576 584861 463715 82089 532513
pg space 425984 409635

work pers clnt lpage
pin 82089 0 0 0
in use 289507 295354 0 0

Thursday, October 09, 2008

Unlock root account in HP-UX

From
How to unlock locked root account in HP-UX

By default HP-UX disables the root account if there is repeated number of failed (bad password) attempts. If you root account has been disabled because of bad password there are two options you two ways you can unlock the account without rebooting the server.

1.If you have sudo installed and your account is setup with root privileges then you can login as sudo su and then you can unlock the account using modprpw

$/usr/local/bin/sudo su –

##/usr/lbin/modprpw –l –k root


2.If you don't have sudo setup then other way out is to check on GSP console if you already have root logged in then you can re-enable root account from GSP console

Thursday, August 21, 2008

About Tape Drive in Solaris

New install:
devfsadm

Already installed
modinfo //find the 'st' driver.
modunload -i //The driver should unload.
mt -f /dev/rmt/0cbn status //The driver should reload.

Tuesday, April 01, 2008

nice command

kill process from "ps -ef"
ps -ef grep -v grep grep [process_name] awk '{print $2}' xargs -t kill -9 >> $outfile 2>&1

Thursday, February 14, 2008

Sybase RPC between different servers

local server: A
remote server: B

1. login to A
2. add server B records at A's interfaces file
3. isql to A's Sybase
4. sp_addserver [server name],[remote server network name (e.g. same as interfaces file)]
  • sp_addserver B,B
  • go
5. create proxy table [table_name] at "[server.db.dbo.table]"
  • use master
  • go

  • create proxy_table proxy_tb_a at "B.db_a.dbo.tb_a"
  • go

  • insert into proxy_tb_a values(....)
  • go

Monday, February 04, 2008

solaris 5.8 notes 3

large file maintenance:
cp large.log large.log.20080204.bak
cat /dev/null > large.log

Monday, December 17, 2007

Solaris Explorer

當你Solaris OS發生問題要怎麼辦
首先,你必須將系統的狀況回報給維護廠商

1. 執行 Explorer 程式:
# cd /opt/SUNWexplo/bin
# ./explorer

如果要針對Storage問題,執行指令如下
# ./explorer -w default,storage,fru

當程式執行完畢你會看到
explorer: Explorer finished 的訊息

2. 當程式執行完後,
# cd /opt/SUNWexplo/output
# ls
explorer.XX-2007.12.16.07.43.XXXX
explorer.XXXXXXXXX-2007.12.16.07.43.tar.gz
把 explorer*.tar.gz 寄出給維護廠商

Wednesday, December 05, 2007

Sybase's Login

Sometimes, we would like to know where a sybase's user come from? (e.g. IP)
1.) Find out the login's suid by using sp_displaylogin
1> sp_displaylogin person1
2> go
Suid: 2608
Loginame: person1
Fullname:
Default Database: mydb
Default Language:
Auto Login Script:
Configured Authorization:
Locked: NO
Date of Last Password Change: Nov 27 2007 11:03AM
Password expiration interval: 0
Password expired: NO
Minimum password length: 6
Maximum failed logins: 0
Current failed login attempts:
(return status = 0)
2.)Then select from sysprocesses by using the "suid"
1> select * from sysprocesses where suid=2608
2> go
spid kpid enginenum status suid hostname
program_name hostprocess cmd cpu physical_io
memusage blocked dbid uid gid
tran_name
time_blocked network_pktsz fid execlass
priority affinity id stmtnum
linenum origsuid block_xloid clientname
clienthostname clientapplname sys_id
ses_id loggedindatetime ipaddr
------ ----------- ----------- ------------ ----------- ----------
---------------- ----------- ---------------- ----------- -----------
----------- ------- ------ ----------- -----------
----------------------------------------------------------------
------------ ------------- ------ ------------------------------
---------- ------------------------------ ----------- -----------
----------- ----------- ----------- ------------------------------
------------------------------ ------------------------------ ------
----------- -------------------------- ---------------
53 163185511 0 recv sleep 2608 ssksdev1
AWAITING COMMAND 0 0
2 0 4 2609 0
NULL
NULL 512 0 EC2
MEDIUM ANYENGINE 0 1
1 NULL 0
0
0 Dec 5 2007 3:56PM 10.47.1.215

(1 rows affected)

3.) Now we know person1 is connected by using 10.47.1.215 machine =)

Friday, November 30, 2007

Thursday, November 08, 2007

Sybase Tuning

Engine
- no. of Engine
Cache
- create temp_cache, hot_cache, etc.
- cache size
- no. of cache partition (e.g. 2,4,8 but no bigger than no. of Engine)
- Large I/O pool (e.g. 2k,16K base on how many cache size?)
DB
- create tempdb, tempdb2, tempdb3, etc.
- sp_bindcache cache_name, dbname
Table / Object
- create index for table
- sp_bindcache cache_name, [,[owner.]tablename [, indexname | "text only" ] ]
Number of User connection
Number of open object

Friday, March 23, 2007

Sybase add user error

Error Message
Server Message: Number 17331, Severity 16
Server 'SYBASE', Procedure 'sp_adduser', Line 253:
User already has a login under a different name.

use the following sp

CREATE PROCEDURE drop_user_null_userdb
AS
DECLARE @username VARCHAR(25)
DECLARE GetOrphanUsers CURSOR
FOR
select Username = name
from userdb..sysusers
where suid not in(select suid from master..syslogins) and gid = 16390 and suid != -2

OPEN GetOrphanUsers
FETCH GetOrphanUsers
INTO @username

WHILE @@sqlstatus = 0
BEGIN

exec sp_dropuser @username


FETCH GetOrphanUsers
INTO @username
END

gid and suid need to change before exec

Thursday, March 22, 2007

solaris 5.8 / 10 notes 2

Remove Interface

1. Remove or rename the /etc/hostname.hme0 file
2. ifconfig hme0 down
3. ifconfig hme0 unplumb
4. Edit /etc/hosts and /etc/netmasks
5. boot

Configure Interface
1. Create the /etc/hostname.hme0 file
2. ifconfig hme0 plumb
3. Edit your /etc/hosts and /etc/netmasks
4. boot

DHCP server:
# dhcpconfig (command prompt)
or
# dhcpmgr (GUI)

Disk Management

fdisk /dev/rdsk/c4t4d5s0 [rdsk/c4t4d6s0]

format>partition

newfs /dev/rdsk/c4t4d5s0 [rdsk/c4t4d6s0]

RAID 0 (concatenation)

metainit d4 3 1 c1t5d0s0 1 c4t4d5s0 1 c4t4d6s0

metainit d4 2 1 c4t4d5s0 1 c4t4d6s0

mount /dev/md/dsk/d4 /sportix4
growfs -M /sportix4 /dev/md/rdsk/d4

/dev/md/dsk/d4 /dev/md/rdsk/d4 /devdb ufs 2 yes -

RAID 1 (umountable file system)

metainit -f d18 1 1 c2t8d0s0

metainit d28 1 1 c2t13d0s0

metainit d8 -m d18

umount /sportix4

vi /etc/vfstab
/dev/md/dsk/d8 /dev/md/rdsk/d8 /sportix4 ufs 2 yes -

mount /sportix4

metattach d0 d2


Add a user with rights as root
change the UID to "0" as same as root from /etc/passwd

Logging for executed commands

Solaris作業系統可以通過設置日 誌檔可以對每個用戶的每一條命令進行紀錄,這一功能默認是不開放的,為了打開它,需要執行/usr/lib/acct目錄下的accton檔,格式如下 /usr/lib/acct/accton /var/adm/pacct,在sun的手冊上,只有這一種用法,但這樣做的缺點是明顯的,大多數有經驗的入侵者一定不會放過/var/adm和 /var/log這兩個目錄的,如果它們看到有pacct這個東西,不刪才怪。針對這種情況其實有個很好的解決辦法,執行 /usr/lib/acct/accton 後面跟一個別的目錄和檔即可,如/usr/lib/acct/accton /yiming/log/commandlog,這樣入侵者不會在/var/adm/下看到pacct,入侵者也許會刪掉message,syslog等 日誌,但他並不知道實際上他所有的操作都被記錄在案,管理員事後只要把commandlog這個檔拷貝到/var/adm下,改為pacct ,同時執行讀取命令lastcomm,就一切盡在掌握啦。如lastcomm hack,可得到下面的輸出結果:

sh S hack pts/7 0.05 secs Mon Jun 12 14:28
sh F hack pts/7 0.00 secs Mon Jun 12 14:39
ls hack pts/7 0.01 secs Mon Jun 12 14:39
ls hack pts/7 0.02 secs Mon Jun 12 14:39
ls hack pts/7 0.01 secs Mon Jun 12 14:38
df hack pts/7 0.03 secs Mon Jun 12 14:38
ftp hack pts/7 0.02 secs Mon Jun 12 14:37
ls hack pts/7 0.01 secs Mon Jun 12 14:37
vi hack pts/7 0.02 secs Mon Jun 12 14:37
who hack pts/7 0.02 secs Mon Jun 12 14:36