Think before you speak, read before you think.

连接vps上的ssh

创建一个权限最低的用户

useradd -M -s /bin/false username

创建该用户的密码:

passwd username
  • windows使用MyenTunnel,输好用户名,密码,ip,端口

在linux下使用密钥认证可以免输密码,而且参考使用ssh_config,创建并在~/.ssh/config里写入以下内容,参考:http://www.lainme.com/doku.php/blog/2011/01/%E4%BD%BF%E7%94%A8ssh_config

jpuyy@ubuntu $ vim ~/.ssh/config
 Host vps
 User jpuyy
 Hostname jpuyy.com
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/id_rsavps
 DynamicForward 7070

这时在shell下使用

$ssh vps

更有一步登天之感。

其他工具

autossh可以在ssh断掉后重连

sudo apt-get install autossh

autossh -M 2000 -N -v  username@hostip

plink可以直接指定密码

ssh需要手动输入,因为把密码表现在history中相当恐怖

sudo apt-get install putty-tools

plink -N -v username@hostip -pw password

sshpass也可以指定密码

Description : Tool for non-interactively performing password authentication with
: so called “interactive keyboard password authentication” of SSH.
: Most users should use more secure public key authentication of SSH
: instead.
yum install sshpass

mosh是在网络比较慢的时候使用,尤其是国外线路

http://mosh.mit.edu/


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *