Using ssh as a SOCKS server

Posted on Fri 10 September 2010 in 我用(IT) • Tagged with chrome, ssh, 浏览器

use ssh as a SOCKS server:

ssh -D port host
windows平台下的ssh命令行可以在以下地址下载: http://sshwindows.sourceforge.net/download/

解释一下-D参数:

-D [bind_address:]port Specifies a local “dynamic” application-level port forwarding. This works by allocating a socket to listen to port on the local side, optionally bound to the specified bind_address. Whenever a connection ...


Continue reading

vps ssh失败的原因和解决方法

Posted on Thu 24 June 2010 in 我用(IT) • Tagged with ssh, vps

新阳给我看了一篇文章,说无法ssh的原因是内存不够了,重启可以解决。刚才重启vps后又能登录了,查了一下日志,apache的错误日志说的都是out of memory,可以作为旁证。

这篇文章提到,一个php-cgi进程要缓存20m内存,于是立刻决定修改一下配置,就分10个PHP进程吧。

vi /etc/php5/apache2/php.ini

这个配置非常的长,看了一遍,还是决定先不改了。

又搜到这篇文章,说ubuntu下头默认安装的apache是用的prefork模式,比较费内存,建议改成worker模式的。查了一下配置中prefork的相关配置

# prefork MPM

StartServers: number of server processes to start

MinSpareServers: minimum number of server processes which are kept spare

MaxSpareServers: maximum ...


Continue reading

ssh自动登录并且su的脚本

Posted on Thu 20 May 2010 in 我用(IT) • Tagged with shell, ssh

从一台Linux机器上用u1用户自动登录到服务器, 然后su成u2

- 需要安装expect

- 脚本如下:

#!/usr/bin/expect
#auto ssh login
set timeout 10
set sshhost [lindex $argv 0]
set u1 "user1"
set p1 "password1"
set u2 "user2"
set p2 "password2"
spawn ssh -l$u1 -pPortNumber $sshhost

expect {
"yes/no" {
send "yesr"
exp_continue
} "*assword:*" {
send "$p1r"
exp_continue
} "*ast login:*" {
# 在s1上变成u2/p2用户 ...

Continue reading

SSH Skills

Posted on Tue 04 August 2009 in 我用(IT) • Tagged with ssh, ubuntu

- change default port
root@Server:~# vi /etc/ssh/ssh_config
/Port

- alias ip to host
root
@Server:~# vi /etc/hosts

- without password
. goal:
root@ServerA:~# ssh ServerB
//need not type password

. steps:
1. gen key
root@ServerA:~# ssh-keygen -t rsa
//type user password and press enter

root@ServerA:~# ls /root/.ssh ...


Continue reading