N73上安装putty连接SSH

今天在N73手机上安装了putty for s60 3nd,以后就可以用它来登录njava了。

一 软件下载
1 PuTTY for Symbian OS
http://s2putty.sourceforge.net/

现在已经到PuTTY 1.5.2了

2 因为我已经禁用了ssh的密码登录了,所以只能用密钥登录。要在putty上使用openssh生成的私钥,还需要PuTTYgen来转换密钥。

http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

二 安装使用

安装putty很简单,按一般s60的程序安装一样,因为开源,不需要破解

n73上的putty程序

n73上的putty程序

Putty的主界面很简洁,就四个设置卡

n73上putty的主界面

n73上putty的主界面

n73上putty的主界面ssh设置卡里设置ssh登录端口,ssh版本,私钥位置等等参数

n73上putty的SSH设置

n73上putty的SSH设置

n73上putty的SSH设置显示卡里设置屏幕风辨率和是否全屏显示,这些设置都可以通过快捷键来完成的

n73上putty的显示设置

n73上putty的显示设置

n73上putty的显示设置日志目录,最好设置到卡里

n73上putty的日志设置

n73上putty的日志设置

设置服务器地址和用户名

n73上putty的基本设置

n73上putty的基本设置

bear登录上了njava的服务器

登录njava成功

登录njava成功

登录njava成功把分辨率调到了最高,字很小设置putty的字体大小

设置putty的字体大小

设置putty的字体大小

N73上的top指令列目录看到的效果

N73上的top指令

N73上的top指令

ls目录

ls目录

ls目录

从巴士ping了一下baidu,3个287ms,还不错ping baidu.com

ping baidu.com

ping baidu.com

看来米国的网络就是好呀,ping米国的google速度嗷嗷的

ping Google.com

ping Google.com

断开SSH的链接,

断开SSH连接
断开SSH连接

教程结束。。。。

Tags: , , ,

星期一, 四月 5th, 2010 服务器 一条评论

2010年4月3号Google PR更新

2010年4月3号下午发现Google PR在更新,Njava的PR还是维持3,希望下3个月的周期里能有所上升。虽然说不重要了,但是受应试教育的影响,还是很期待这个分数的。同时今天Apple也正式发售IPAD了,希望有一天能弄一个来玩玩

Tags: , , ,

星期日, 四月 4th, 2010 网络 没有评论

使用find命令定期删除n天前的日志文件

日志和备份多了,硬盘不够了,所以删除之

bear@njava:/data/log$ find /data/log -mtime +3 -exec rm -rf {} \;

关于find参数-mtime,-ctime,-atime

bear@njava:~$ man find
       -mtime n
              File's data was last modified n*24 hours ago.  See the comments for -atime to understand how  rounding
              affects the interpretation of file modification times.
       -ctime n
              File's status was last changed n*24 hours ago.  See the comments for -atime to understand how rounding
              affects the interpretation of file status change times.
      -atime n
              File  was  last  accessed n*24 hours ago.  When find figures out how many 24-hour periods ago the file
              was last accessed, any fractional part is ignored, so to match -atime +1, a  file  has  to  have  been
              accessed at least two days ago.

Tags: , ,

星期六, 四月 3rd, 2010 服务器 没有评论

linux的内存使用查看和实际可用内存计算

使用free,top等工具都可以查看linux的内存使用量,如
使用top命令

bear@njava:/etc/nginx/conf# top
Tasks:  36 total,   2 running,  32 sleeping,   2 stopped,   0 zombie
Cpu(s):  0.3%us,  0.3%sy,  0.0%ni, 99.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    524800k total,   478320k used,    46480k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
15658 www-data  23   0 49188 7280 4104 S  0.0  1.4   0:00.03 php5-cgi           
15663 www-data  16   0 57888  28m  16m S  0.0  5.5   0:12.62 php5-cgi           
15664 www-data  16   0 60704  32m  18m S  0.0  6.4   0:11.99 php5-cgi           
15665 www-data  16   0 59488  29m  16m S  0.0  5.8   0:11.00 php5-cgi           
15667 www-data  18   0 58388  30m  17m S  0.0  5.9   0:11.62 php5-cgi           
15668 www-data  16   0 58628  28m  16m S  0.0  5.6   0:12.05 php5-cgi           
15669 www-data  16   0 58660  29m  16m S  0.0  5.7   0:09.81 php5-cgi           
15670 www-data  16   0 56220  26m  16m S  0.0  5.2   0:11.24 php5-cgi           
15671 www-data  16   0 59432  29m  16m S  0.0  5.8   0:11.04 php5-cgi           
15673 www-data  16   0 54596  25m  16m S  0.0  4.9   0:12.43 php5-cgi           
15674 www-data  16   0 58036  27m  15m S  0.0  5.4   0:11.66 php5-cgi           
19790 www-data  15   0 10856 2644 1008 S  0.0  0.5   0:02.18 nginx              
19791 www-data  18   0 10856 2676 1060 S  0.0  0.5   0:01.55 nginx              
19939 www-data  17   0  6936 3136  744 S  0.0  0.6   0:00.11 nginx-fcgi 

使用free命令

bear@njava:/etc/nginx/conf# free
             total       used       free     shared    buffers     cached
Mem:        524800     476756      48044          0          0          0
-/+ buffers/cache:     476756      48044
Swap:            0          0          0
bear@njava:/etc/nginx/conf# 

又那么多的内存参数字段:used,free,shared,buffers,cached
怎么计算实际剩余可用内存呢?
公式如下:

空闲内存=free+buffers+cached

看上去巴士的vps不适合做这个例子,呵呵,当作留存吧

Tags: ,

星期五, 四月 2nd, 2010 服务器 没有评论

ubuntu修改时区

查看时区

bear@njava:#  date -R

修改为+8时区的上海

bear@njava:#  cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

Tags: ,

星期五, 四月 2nd, 2010 服务器 没有评论

nginx的stub_status状态信息解释

打开nginx的stub_status可以通过页面链接看到如下信息

Active connections: 353
server accepts handled requests
 532423 532423 3283276
Reading: 1 Writing: 1 Waiting: 351

他们是啥意思呢,解释如下
active connections:353 #nginx 正处理的活动连接数 353个。
server accepts handled requests
nginx启动到现在共处理了 532423个连接 ,
nginx启动到现在共成功创建 532423 次握手 ,
请求丢失数=(握手-连接),可以看出,我们没丢请求
总共处理了3283276 次请求。
Reading :nginx 读取到客户端的 Header 信息数。
Writing : nginx 返回给客户端的 Header 信息数。
Waiting : Nginx 已经处理完正在等候下一次请求指令的驻留连接。开启 keep-alive 的情况下,这个值等于 active – (reading + writing)。

Tags: ,

星期五, 四月 2nd, 2010 服务器 没有评论

cacti的rrdtool画不出图来的问题

1 习惯性的把rrd的文件rm -rf *掉了,发现cron过了好多次都没画出图来
2 检查权限,权限ok的,cron的执行用户和/var/www/cacti/rra目录的拥有者是同一个用户

bear@njava:/var/www/cacti/rra$ sudo vi /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
*/5 * * * * www-data php /var/www/cacti/poller.php > /dev/null 2>&1

3 把Poller Type由spine改成cmd.php,奇迹发生了,图被画出来了,之后再改回spine,运转正常

Tags: ,

星期四, 四月 1st, 2010 服务器 没有评论

cacti通过snmp监控ubuntu9.10网卡流量遇到的问题

折腾无线,snmp总是链接不上,debug报如下错误;

+ Running data query [1].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.2.1.2.2.1.1'
+ No SNMP data returned
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'

谷歌百度,终于找到解决办法,记录之。。。

bear@njava:/var/www/njava$ sudo vi /etc/snmp/snmpd.conf 
# First, map the community name (COMMUNITY) into a security name
# (local and mynetwork, depending on where the request is coming
# from):
# sec.name  source          community
#com2sec paranoid  default         public
#com2sec paranoid  default         njava
com2sec readonly  default         public
bear@njava:/var/www/njava$ sudo /etc/init.d/snmpd restart

获取到后的数据源

+ Running data query [1].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.2.1.2.2.1.1'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.1' value: '1'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.2' value: '2'
+ Index found at OID: '1.3.6.1.2.1.2.2.1.1.3' value: '3'
+ Located input field 'ifIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.1'
+ Found item [ifIndex='1'] index: 1 [from value]
+ Found item [ifIndex='2'] index: 2 [from value]
+ Found item [ifIndex='3'] index: 3 [from value]
+ Located input field 'ifOperStatus' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.8'
+ Found item [ifOperStatus='Up'] index: 1 [from value]
+ Found item [ifOperStatus='Up'] index: 2 [from value]
+ Found item [ifOperStatus='Down'] index: 3 [from value]
+ Located input field 'ifDescr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.2'
+ Found item [ifDescr='lo'] index: 1 [from value]
+ Found item [ifDescr='eth0'] index: 2 [from value]
+ Found item [ifDescr='eth1'] index: 3 [from value]
+ Located input field 'ifName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.31.1.1.1.1'
+ Found item [ifName='lo'] index: 1 [from value]
+ Found item [ifName='eth0'] index: 2 [from value]
+ Found item [ifName='eth1'] index: 3 [from value]
+ Located input field 'ifAlias' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.31.1.1.1.18'
+ Found item [ifAlias=''] index: 1 [from value]
+ Found item [ifAlias=''] index: 2 [from value]
+ Found item [ifAlias=''] index: 3 [from value]
+ Located input field 'ifType' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.3'
+ Found item [ifType='softwareLoopback(24)'] index: 1 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 2 [from value]
+ Found item [ifType='ethernetCsmacd(6)'] index: 3 [from value]
+ Located input field 'ifSpeed' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.5'
+ Found item [ifSpeed='10000000'] index: 1 [from value]
+ Found item [ifSpeed='100000000'] index: 2 [from value]
+ Found item [ifSpeed='0'] index: 3 [from value]
+ Located input field 'ifHwAddr' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.2.2.1.6'
+ Found item [ifHwAddr=''] index: 1 [from value]
+ Found item [ifHwAddr='00:0D:60:D4:BC:04'] index: 2 [from value]
+ Found item [ifHwAddr='00:0D:60:D4:BC:05'] index: 3 [from value]
+ Located input field 'ifIP' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.2.1.4.20.1.2'
+ Found item [ifIP='127.0.0.1'] index: 1 [from regexp oid parse]
+ Found item [ifIP='8.8.8.8'] index: 2 [from regexp oid parse]
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'
+ Found data query XML file at '/var/www/cacti/resource/snmp_queries/interface.xml'

参考:http://www.linuxquestions.org/questions/linux-networking-3/cacti-traffic-stats-snmp-config-prob-378983/

Tags: , ,

星期四, 四月 1st, 2010 服务器 没有评论

ubuntu网卡流量实时查看

1  工具iftop


bear@njava:~# sudo apt-get install iftop

bear@njava:~# sudo iftop

2 工具nload


bear@njava:~# sudo apt-get install nload

bear@njava:~# nload

Tags: ,

星期三, 三月 31st, 2010 服务器 没有评论

Nginx的防盗链模块NginxHttpAccessKeyModule

1 下载

bear@njava:/$wget http://wiki.nginx.org/images/5/51/Nginx-accesskey-2.0.3.tar.gz

2 配置

bear@njava:/$tar -xzvf Nginx-accesskey-2.0.3.tar.gz
bear@njava:/$vi ../nginx-accesskey-2.0.3/config
USE_MD5=YES
USE_SHA1=YES
ngx_addon_name=ngx_http_accesskey_module
#HTTP_MODULES="$HTTP_MODULES $HTTP_ACCESSKEY_MODULE"
HTTP_MODULES="$HTTP_MODULES ngx_http_accesskey_module"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_accesskey_module.c"

3 重编译nginx

bear@njava:~/nginx-0.8.34# ./configure --conf-path=/etc/nginx/nginx.conf \--error-log-path=/var/log/nginx/error.log --pid-path=/var/run/nginx.pid --lock-path=/var/lock/nginx.lock --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/body --http-proxy-temp-path=/var/lib/nginx/proxy --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --with-debug --with-http_stub_status_module --with-http_flv_module --with-http_ssl_module --with-http_dav_module --with-http_gzip_static_module --with-mail --with-mail_ssl_module --with-ipv6 --with-http_realip_module --with-http_geoip_module --with-http_xslt_module --with-http_image_filter_module --with-sha1=/usr/include/openssl --with-md5=/usr/include/openssl --add-module=../gnosek-nginx-upstream-fair-2131c73 --add-module=../nginx-accesskey-2.0.3

4 配置NginxHttpAccessKeyModule

bear@njava:~/nginx-0.8.34$ vi /etc/nginx/sites-available/njava
       location /test {
         accesskey             on;
         accesskey_hashmethod  md5;
         accesskey_arg         "abc";
         accesskey_signature   "njavakey$remote_addr";
         }

5 重启nginx

6 使用
使用的时候参考代码如下:

function get_acc_url($url){
  return $url."?abc=" . md5('njavakey' . $_SERVER['REMOTE_ADDR']);
}

7 代码测试
http://www.njava.com/a.php

Tags: , ,

星期二, 三月 30th, 2010 服务器 没有评论
Pages: Prev 1 2 3 4 5 6 7 8 9 10 ... 13 14 15 Next
1LMooBmUE153Wnd3zDryWvDyXxQudbFxDr