12/15/2011

How to Solve NO_PUBKEY 07DC563D1F41B907

 This error appere when use command #apt-get update

W: GPG error: http://www.debian-multimedia.org squeeze Release:
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 07DC563D1F41B907
To solve this problem we need user  to install the package debian-keyring
# apt-get install debian-keyring
and then execute this command:
# gpg --keyring /usr/share/keyrings/debian-keyring.gpg -a --export 07DC563D1F41B907 |apt-key add -

11/22/2011

iOs storyboard

http://kurrytran.blogspot.com/2011/10/ios-5-storyboard-and.html

http://maniacdev.com/ios-5-sdk-tutorial-and-guide/xcode-4-storyboard/

10/07/2011

jquery

jquery tool : http://flowplayer.org/tools/index.html
jquery effects : 20+ Demos Showing Advanced jQuery Effects

straight forward sep

http://webdesign.tutsplus.com/tutorials/htmlcss-tutorials/straightforward-seo-for-webdesigners/

javascript ? shift



8/11/2011

8/04/2011

Mac : check java version

$ javac -version
javac 1.6.0_15
$ which javac
/usr/bin/javac

$ ls -la /System/Library/Frameworks/JavaVM.framework/Versions/
lrwxr-xr-x 1 root wheel 5 Sep 24 20:12 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 Jul 21 07:35 1.3.1
lrwxr-xr-x 1 root wheel 10 Sep 24 20:12 1.5 -> CurrentJDK
lrwxr-xr-x 1 root wheel 10 Sep 24 20:12 1.5.0 -> CurrentJDK
lrwxr-xr-x 1 root wheel 5 Sep 24 20:12 1.6 -> 1.6.0
drwxr-xr-x 7 root wheel 238 Sep 24 20:12 1.6.0
drwxr-xr-x 8 root wheel 272 Sep 24 20:12 A
lrwxr-xr-x 1 root wheel 1 Sep 24 20:12 Current -> A
lrwxr-xr-x 1 root wheel 3 Sep 24 20:12 CurrentJDK -> 1.6

7/12/2011

Apache tuning

http://www.devside.net/articles/apache-performance-tuning

Netstat : How to Find and Check Number of Connections to a Server

netstat -na
Display all active Internet connections to the servers and only established connections are included.

netstat -an grep :80 sort

Show only active Internet connections to the server at port 80 and sort the results. Useful in detecting single flood by allowing users to recognize many connections coming from one IP.

netstat -n -p|grep SYN_REC | wc -l
Let users know how many active SYNC_REC are occurring and happening on the server. The number should be pretty low, preferably less than 5. On DoS attack incident or mail bombed, the number can jump to twins. However, the value always depends on system, so a high value may be average in another server.

netstat -n -p | grep SYN_REC | sort -u
List out the all IP addresses involved instead of just count.

netstat -n -p | grep SYN_REC | awk '{print $5}' | awk -F: '{print $1}'
List all the unique IP addresses of the node that are sending SYN_REC connection status.

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
Use netstat command to calculate and count the number of connections each IP address makes to the server.

netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n
List count of number of connections the IPs are connected to the server using TCP or UDP protocol.

netstat -ntu | grep ESTAB | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
Check on ESTABLISHED connections instead of all connections, and displays the connections count for each IP.

netstat -plan|grep :80|awk {'print $5'}|cut -d: -f 1|sort|uniq -c|sort -nk 1
Show and list IP address and its connection count that connect to port 80 on the server. Port 80 is used mainly by HTTP web page request.

netstat -nt | grep 80 | wc
find total connection

7/11/2011

Mysql :my.cnf Tuning

[mysqld]
user=mysql
bind-address=127.0.0.1
datadir=/var/lib/mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysql/mysql.sock
port=3306
tmpdir=/tmp
language=/usr/share/mysql/english
skip-external-locking

query_cache_limit=64M
query_cache_size=32M
query_cache_type=1

max_connections=15
max_user_connections=300
interactive_timeout=100
wait_timeout=100
connect_timeout=10

thread_stack=128K
thread_cache_size=128

myisam-recover=BACKUP

key_buffer=64M
join_buffer=1M
max_allowed_packet=32M
table_cache=512M
sort_buffer_size=1M
read_buffer_size=1M
read_rnd_buffer_size=768K
max_connect_errors=10
thread_concurrency=4

myisam_sort_buffer_size=32M
skip-locking
skip-bdb
expire_logs_days=10
max_binlog_size=100M
server-id=1

[mysql.server]
user=mysql
basedir=/usr

[safe_mysqld]
bind-address=127.0.0.1
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192
SAFE_MYSQLD_OPTIONS=”–defaults-file=/etc/my.cnf –log-slow-queries=/var/log/slow-queries.log”

[mysql]
[isamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[myisamchk]
key_buffer=64M
sort_buffer=64M
read_buffer=16M
write_buffer=16M

[mysqlhotcopy]
interactive-timeout
max_heap_table_size = 64 M
tmp_table_size = 64 M
!includedir /etc/mysql/conf.d/I’ve gone back and forth over the years configuring MySQL for optimal performance, and while I know I’m not there, I now have a new baseline to build from. From a post called Standard MYSQL my.cnf configuration, you can see all the base information, but also things like:

key_buffer=256M # 64M for 1GB, 128M for 2GB, 256 for 4GBWhich defines the value (256M) but then spells out ideal base values for you to start with if you have more RAM on your system. This is very helpful, I’m tried to go a step further by combining it with Debian’s default my.cnf that comes on 5.0 (lenny) for MySQL 5. As I’m always open for suggestions for improvements, please comment if you have a different view on these choices, thanks. Here it is:

[client]
socket=/var/run/mysqld/mysqld.sock
port=3306

[mysqld_safe]
socket=/var/run/mysqld/mysqld.sock
nice=0

[mysqld]
user=mysql
bind-address=127.0.0.1
datadir=/var/lib/mysql
pid-file=/var/run/mysqld/mysqld.pid
socket=/var/run/mysql/mysql.sock
port=3306
tmpdir=/tmp
language=/usr/share/mysql/english
skip-external-locking
query_cache_limit=1M
query_cache_size=32M
query_cache_type=1
max_connections=3000
max_user_connections=600
interactive_timeout=100
wait_timeout=100
connect_timeout=10
thread_stack=128K
thread_cache_size=128
myisam-recover=BACKUP
#key_buffer - 64M for 1GB, 128M for 2GB, 256 for 4GB
key_buffer=64M
#join_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
join_buffer=1M
max_allowed_packet=32M
table_cache=1024
#sort_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
sort_buffer_size=1M
#read_buffer_size - 1M for 1GB, 2M for 2GB, 4M for 4GB
read_buffer_size=1M
#read_rnd_buffer_size - 768K for 1GB, 1536K for 2GB, 3072K for 4GB
read_rnd_buffer_size=768K
max_connect_errors=10
thread_concurrency=4
#myisam_sort_buffer_size - 32M for 1GB, 64M for 2GB, 128 for 4GB
myisam_sort_buffer_size=32M
skip-locking
skip-bdb
expire_logs_days=10
max_binlog_size=100M
server-id=1

[mysql.server]
user=mysql
basedir=/usr

[safe_mysqld]
bind-address=127.0.0.1
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
open_files_limit=8192
SAFE_MYSQLD_OPTIONS=”–defaults-file=/etc/my.cnf –log-slow-queries=/var/log/slow-queries.log”

#[mysqldump]
#quick
#quote-names
#max_allowed_packet=16M

[mysql]
#no-auto-rehash # faster start of mysql but no tab completition

[isamchk]
#key_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
key_buffer=64M
#sort_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
sort_buffer=64M
#read_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
read_buffer=16M
#write_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
write_buffer=16M

[myisamchk]
#key_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
key_buffer=64M
#sort_buffer - 64M for 1GB, 128M for 2GB, 256M for 4GB
sort_buffer=64M
#read_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
read_buffer=16M
#write_buffer - 16M for 1GB, 32M for 2GB, 64M for 4GB
write_buffer=16M

[mysqlhotcopy]
interactive-timeout

!includedir /etc/mysql/conf.d/

7/05/2011

HTML5

HTML5

framework
http://www.limejs.com/ : is a HTML5 game framework for building fast, native-experience games for all modern touchscreens and
desktop browsers.

6/17/2011

Mobile Web

how to develop standards-compliant and usable mobile web applications

http://learnthemobileweb.com/

6/02/2011

SSL : View Cert

View The Contents of A Certificate Signing Request (CSR)

#openssl req -text -noout -in host.csr

View x509 certificate details

#openssl x509 -in filename.crt -noout -text

Howto Secure Apache

1. Use the latest and most current version. Right now the latest is the Apache 2.2 series
2. Make sure you’ve installed all the latest security patches
3. Hide the Apache Version number, and other sensitive information
4. Make sure apache is running under its own user account and group
5. Ensure that files outside the web root are not served
6. Turn off directory browsing (mod_autoindex)
7. Turn off server side includes (SSI)
8. Turn off CGI execution
9. Don’t allow apache to use symbolic links
10. Turning off multiple Options
11. Turn off support for .htaccess files
12. Use the Apache mod_security
13. Disable all unnecessary modules
14. Make sure only root has read access to apache’s config and binaries
15. Lower the Timeout value
16. Limiting large requests
17. Limiting Concurrency
18. Restricting Access by IP
19. Adjusting KeepAlive settings
20. Run Apache in a Chroot environment

Generation of SSL certificates bought by Godaddy quick and easy

# /usr/bin/openssl req -new -key /home/dirtowww/www.domain.com.key -out /home/dirtowww/www.domain.com.csr

or

#openssl req -new -newkey rsa:1024 -keyout server.key -out server.csr

http://www.jquery.in.th/generate-ssl-certificate/

http://www.redkestrel.co.uk/Articles/CSR.html

http://www.pc-freak.net/blog/generation-of-ssl-certificates-bought-by-godaddy-quick-and-easy/

http://help.godaddy.com/article/5349?locale=en

http://www.spacereg.com/help_csr_modssl.html

wizard

https://www.digicert.com/easy-csr/openssl.htm

SSL: Verifying that a Certificate matches a Private Key

The private key contains a series of numbers. Two of those numbers form the “public key”, the others are part of your “private key”. The “public key” bits are also embedded in your Certificate (we get them from your CSR). To check that the public key in your cert matches the public portion of your private key, you need to view the cert and the key and compare the numbers.
Normally it requires some manual number matching to match a given private key with a given certificate, however with this command you are able to do a comparison automatic:

$ (openssl x509 -noout -modulus -in server.pem openssl md5 ;
openssl rsa -noout -modulus -in server.key openssl md5) uniq

(If more than one hash is displayed, they don’t match)

CSR : Certificate Signing Request

How to Generate CSR use OpenSSL

1. Create a RSA private key for your Apache server, PEM-formatted:

#openssl genrsa -out domain.com.key 1024

2. Create a Certificate Signing Request using the RSA private key created above (output will be PEM format):

#openssl req -new -key domain.com.key -out domain.com.csr

Note that the Common Name field is the field where the domain name should be stated.

How to setup CSR

1. Copy your issued certificate, intermediate certificate and key file (generated when you created the Certificate Signing Request (CSR)) into the directory that you will be using to hold your certificates.
2. Open the Apache ssl.conf file and add the following directives: *

SSLCertificateFile /path to certificate file/your issued certificate *
SSLCertificateKeyFile /path to key file/your key file *
SSLCertificateChainFile /path to intermediate certificate/gd_intermediate_bundle.crt

Save your ssl.conf file and restart Apache.

CSR : Generate a Certificate Signing Request (CSR) for Apache + Mod SSL + OpenSSL

1. Install OpenSSL

2. Create a RSA key for your Apache server:
cd /apacheserverroot/conf/ssl.key (ssl.key is the default key directory.)

NOTE: If you have a different path, cd to your server’s private key directory...

3. Type the following command to generate a private key that is file encrypted. You will be prompted for the password to access the file and also when starting your web server.

Warning: If you lose or forget the pass phrase, you must purchase another certificate.

#openssl genrsa -des3 -out domainname.key 2048
You could also create a private key without file encryption if you do not want to enter the pass phrase when starting your web server:

#openssl genrsa -out domainname.key 2048
Note: We recommend that you name the private key using the domain name that you are purchasing the certificate for ie domainname.key

4. Type the following command to create a CSR with the RSA private key (output will be PEM format):


#openssl req -new -key domainname.key -out domainname.csr


* Note: You will be prompted for your PEM pass phrase if you included the "-des3" switch in step 3.

5. When creating a CSR you must follow these conventions. Enter the information to be displayed in the certificate. The following characters can not be accepted: < > ~ ! @ # $ % ^ * / \ ( ) ?.,&

Common Name : The fully qualified domain name for your web server. This must be an exact match.

Organization : The exact legal name of your organization. Do not abbreviate your organization name.

Organization Unit : Section of the organization

City or Locality : The city where your organization is legally located.

State or Province : The state or province where your organization is legally located. Can not be abbreviated.

Country : The two-letter ISO abbreviation for your country.

6. Do not enter extra attributes at the prompt. Warning: Leave the challenge password blank (press enter) Note: If you would like to verify the contents of the CSR, use the following command:


#openssl req -noout -text -in domainname.csr

7. Submit the CSR during a enrollment by opening the CSR in a text editor such as Notepad or Vi and copying and pasting the text into the Enter CSR box.

8. We recommend that you create a backup of your private key

To do this make a copy of the private key file (domainname.key) generated in step 3 and store it in a safe place. If you lose this file, you must purchase a new certificate.
* The private key file should begin with (when using a text editor)

-----BEGIN RSA PRIVATE KEY

----- and end with -

----END RSA PRIVATE KEY-----.


To view the contents of the private key, use the following command:
openssl rsa -noout -text -in domainname.key


from : https://knowledge.rapidssl.com/support/ssl-certificate-support/index?page=content&id=SO13985





5/30/2011

rewriteguide

http://httpd.apache.org/docs/1.3/misc/rewriteguide.html

How to add Mime-Types using .htaccess

http://www.besthostratings.com/articles/mime-types-htaccess.html

3/29/2011

Php : Tips

find path php.ini

php -i | grep php.ini
Configuration File (php.ini) Path => /etc/php5/cli
Loaded Configuration File => /etc/php5/cli/php.in

3/28/2011

Linux (Debian) : Mail Server

The Big Picture

http://workaround.org/ispmail/lenny/bigpicture

iRedMail
http://www.howtoforge.com/virtual-users-with-postfix-dovecot-mysql-roundcube-iredadmin-on-debian-6-squeeze

Linux (Apache) : mod rewrite

root@debian:/a2enmod rewrite
Enabling module rewrite.
Run '/etc/init.d/apache2 restart' to activate new configuration!
root@debian:/var/log# /etc/init.d/apache2 restart

edit site
/etc/apache2/sites-enabled/000-default


ServerAdmin webmaster@localhost

DocumentRoot /var/www

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all


:
:



ดูที่ โดยมองที่ AllowOverride None ให้เปลี่ยนเป็น All

#/etc/init.d/apache2 restart

ไฟล์ .htaccess




config apache : http://www.aboutdebian.com/internet.htm

3/26/2011

Hosting Control panel

Manager and Hosting Control panel

http://www.lxcenter.org/

3/25/2011

Apache : site enable

site enable
/etc/apache2/sites-available

#a2ensite sitename

remove site
#a2dissite sitename


ที่มา : http://www.debian-administration.org/articles/207

Linux (Debian) : user nologin shell

เนื่องจาก vsftpd ใช้ user ตรงๆ จาก os เลย ดังนั้นการสร้าง user ก็เป็นการสร้าง user ของ os ด้วยคำสั่ง useradd ซื้อมีออฟชั่นให้ใช้ล้านเจ็ดสิบเอ็ดแสน

useradd [options] LOGINNAME

เมื่อสร้าง user แล้ว อย่าลืมตั้งรหัสผ่านให้ user ที่สร้างด้วยคำสั่ง passwd LOGIN ด้วยนะครับ

ใน option เราต้องระบุ shell สำหรับ user นั้นด้วย แนะนำให้ระบุ shell ไปที่ /usr/sbin/nologin เพื่อที่จะให้ user ท่านนี้สามารถ เข้าใช้ ftp ได้ แต่ไม่สามารถใช้งาน shell ได้
แต่จะใช้ /usr/sbin/nologin ได้นั้น ต้องไปแก้ไขไฟล์ /etc/shells ก่อน ให้ดูว่า มีบรรทัด/usr/sbin/nologin อยู่รึยัง ถ้ายังไม่มี ให้เพิ่มเข้าไป

Linux (Debian) : vsftpd

install
#apt-get install vsftpd

Config
#vi /etc/vsftpd.conf

listen=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
file_open_mode=0777
local_umask=022
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
xferlog_std_format=YES
ftpd_banner=Welcome to unbbz FTP Service.
secure_chroot_dir=/var/run/vsftpd
pam_service_name=vsftpd
chroot_local_user=YES


restart vsftpd
#/etc/init.d/vsftpd restart

3/24/2011

Linux : Debain fail2ban

Install Fail2ban

#apt-get install fail2ban
หลังจากลงเสร็จแล้วให้ทำการ copy ไฟล์ใหม่ขึ้นมานะครับเพื่อทำการแก้ไข

config file
#/etc/fail2ban/jail.conf

Edit Config file
#nano /etc/fail2ban/jail.local

[DEFAULT]
ignoreip = 127.0.0.1 # เป็น ip ที่จะไม่มีการ Ban
bantime =600 # เป็นเวลาที่จะ Ban IPสามารถเพิ่มลดได้ตามต้องการครับ
maxretry = 3 # คือตัวระบุการทำผิดพลาด 3ครั้งสามารถตั้งได้ตามต้องการ

[ssh-ddos]
enabled = true # ผมเปลี่ยนจาก false เป็น true เพื่อเพิ่มการตรวจสอบ SSH DoS
port = ssh, sftp
filter = sshd-ddos

เมื่อทำการแก้ไข config เสร็จแล้วให้ทำการ restart หervice ให้ทำงานได้เลยครับ

#/etc/init.d/fail2ban restart
และคุณสามารถเช็ค log ได้ที่นี่ครับ

#tail /var/log/fail2ban.log
อยากรู้ว่าใช้งานได้ไม่ได้นั้นลองทำการ login ได้เลยครับใส่มั่วๆลองเข้าไปดูแล้วรอเวลาที่เราตั้งให้มัน unban เองครับหรือว่ามีอีกเครื่องนึงก็ลอง ssh เข้าไปดู

#tail /var/log/fail2ban.log
iptables -X fail2ban-[name]
2007-11-28 13:25:59,853 fail2ban.actions.action: INFO
Set actionStart = iptables -N fail2ban-[name]
iptables -A fail2ban-[name]. -j RETURN
iptables -I INPUT -p -m multiport –dports
[port] -j fail2ban-[name]
2007-11-28 13:25:59,854 fail2ban.actions.action: INFO
Set actionUnban = iptables -D fail2ban-[name] -s -j DROP
2007-11-28 13:25:59,855 fail2ban.actions.action: INFO
Set actionCheck = iptables -n -L INPUT | grep -q fail2ban-[name]
2007-11-28 19:01:00,896 fail2ban.actions: WARNING [ssh] Ban 124.121.118.234
2007-11-28 19:03:46,896 fail2ban.actions: WARNING [ssh] Ban 202.142.215.206

การ unban

root@bebian:/home/redcode# iptables -n -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
fail2ban-ssh tcp — 0.0.0.0/0 0.0.0.0/0 multiport dports 22,115

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain fail2ban-ssh (1 references)
target prot opt source destination
DROP 0 — 202.142.215.206 0.0.0.0/0
DROP 0 — 124.121.118.234 0.0.0.0/0
RETURN 0 — 0.0.0.0/0 0.0.0.0/0
แล้วจากนั้นก็ใส่ DROP iptables โดยระบุ IP ที่เราต้องการ DROP ไปซ่ะ

root@bebian:/home/redcode# iptables -D fail2ban-ssh -s 124.121.118.234 -j DROP
DROP แล้วทำการเช็คดู iptable ดูครับว่า IP ที่เรา DROP ไปนั้นออกไปยัง

root@bebian:/home/redcode# iptables -n -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
fail2ban-ssh tcp — 0.0.0.0/0 0.0.0.0/0 multiport dports 22,115

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain fail2ban-ssh (1 references)
target prot opt source destination
DROP 0 — 202.142.215.206 0.0.0.0/0
RETURN 0 — 0.0.0.0/0 0.0.0.0/0
สังเกตุได้ว่า IP 124.121.118.234 ออกไปจากระบบแล้วเพียงเท่านี้ก็สามารถ login ได้ปกติ

Linux : Alias

Set Command Alias for commands often used.

1. Apply to all users.

root@debian:~# vi /etc/profile

# last line: add aliases
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

root@debian:~# source /etc/profile # reload

2.Apply to a user

user@debian:~$ vi .bashrc

# last line: add aliases
alias ll='ls $LS_OPTIONS -l'
alias l='ls $LS_OPTIONS -lA'
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

user@debian:~$ source .bashrc # reload

3/23/2011

Hack

http://poc-hack.blogspot.com/

3/22/2011

Code Snippet

Add msn
msnim:add?contact=ใส่Emailของท่าน@hotmail.com

2/04/2011

Iphone : repository

iphone repo is debian repository
Os: Debian or Ubuntu
how to :
1. โครงสร้าง folder ของ application , theme , wallpaper , ringtone จะเหมือนกับโครงสร้าง folder เหล่านั้น ที่อยู่ใน iphone
Theme
[ThemeFolder]
--[DEBIAN]
----Control(file)
--[Library]
----[Themes]
------[ThemeFolderFile]

2. build a deb
#dpkg-deb -b FolderName
result : FolderName.deb

3. move file to folder for download file
etc. /var/www/cydia/deb/

4.create package info
in path /var/www/cydia use command
#dpkg-scanpackages -m . /dev/null >Packages

5.compact file Packages
#bzip2 Packages
result : Packages.bz2

from : http://www.saurik.com/id/7

2/03/2011

Debian : useradd & adduser

-adduser จะสร้าง home เพิ่ม group พร้อมทั้งให้กรอก password
-useradd จะเพิ่ม user เข้าไปใน /etc/passwd กับเพิ่ม group เข้าไปที่ /etc/group ถ้าต้องการให้สร้าง home ให้ด้วย ต้องใส่ option -m

2/02/2011

Debian : apt-get

dist-upgrade vs upgrade

This command installs the latest versions of any out-of-date packages on your system. It never installs a package that is not yet installed.

apt-get dist-upgradeThis command installs up-to-date version of packages, and may install additional packages.

if you want to do a distro-upgrade, use dist-upgrade. For instance, moving from Debian -stable to Debian -testing. Dist-upgrade is a special upgrade that is used if you are fetching packages from a new location, which is specified in /etc/apt/sources.list

If you want to simply upgrade the packages you have installed for your current distro, use 'apt-get upgrade'.