Tuesday, May 16, 2006

通过ssh访问远程linux主机

1. 在window通过cygwin
1)创建RSA key
In $(CYGWINDIR)\usr\bin, execute ssh-keygen.exe, this will ask you for inputting some key password, just press enter for a null password and accept other default settings.
ssh-keygen.exe will generate a pair of keys in the $(CURRENT_USER_PROFILE)\.ssh\ directory, id_rsa and id_rsa.pub which are the private RSA key and the public RSA key, respectively. $(CURRENT_USER_PROFILE) are normally d:\profiles\$(YOUR_EMAILID).
Since the private key id_rsa are stored in the windows machine which is itself password-pretected, null password for the key during the creation procedure by ssh-keygen.exe will not make your system LESS secure.
2) 拷贝公钥到远程linux
保存在$(HOME)/.ssh/authorized_keys文件中
3) 通过ssh登录远程主机。

2.在远程主机运行图形界面到windows的cygwin
在windows命令行界面运行ipconfig查看本地IP。
运行cygwin并startx启动X server
运行xhost +命令允许远程使用本地X服务
登录远程linux主机设置远程linux主机的环境变量DISPLAY=windows_host_ip:0.0
运行图形界面程序。

No comments: