当前位置:操作系统 > Unix/Linux >>

漫谈:怎么在Linux上使用SSH2

软件取得

  1 RedHat 6.2

  http://freesoft.online.sh.cn/

  2 SSH2 Server

  rpm : ssh-commercial-server-2.2.0-2nox.i386.rpm

  source: ssh-2.2.0.tar.gz

  http://www.ssh.com

  3 SSH2 Client

  rpm : ssh-commercial-workstation-2.2.0-2.i386.rpm

  http://www.ssh.com

  软件安装

  说明:Remote Host Name :Remote (Server) 192.168.1.222

  Local Host Name :Local (Client) 192.168.1.223

  1 安装 Redhat6.2

  2 安装 SSH2 Server(Remote Host)

  使用 RPM

  [root@Remote root]# rpm -ivh ssh-commercial-server-2.2.0-2nox.i386.rpm

  使用 SOURCE

  [root@Remote root]# tar xzvf ssh-2.2.0.tar.gz

  # cd ssh-2.2.0

  # ./configure

  # make

  # make install

  3 安装 SSH2 Clinet(Local Host)

  [root@Local root]# rpm -ivh ssh-commercial-workstation-2.2.0-2.i386.rpm

  系统配置

  1.在 Remote Host 启动sshd

  [root@Remote root]/usr/loca/sbin/sshd2

  2 在 Local Host 添加用户账号 如 bill

  [root@Local root] useradd bill

  [root@Local root] passwd bill

  3 在Client 上建立用户的公共和私人密钥

  以bill登陆到 Local Host 上

  [bill@Local local]$ ssh-keygen

  Generating 1024-bit dsa key pair

  9 o.oOo..oOo.o

  Key generated.

  1024-bit dsa, created by bill@Local Wed Sep 23 07:11:02 1998

  Passphrase :输入一些字符,不超过20个

  Again :重复输入一遍

  Private key saved to /home/bill/.ssh2/id_dsa_1024_a

  4 在Client 上建立用户的认证文件

  以bill登陆到 Local Host 上

  [bill@Local local]$cd ~/.ssh2

  [bill@Local local]$echo "IdKey id_dsa_1024_a" > identification

  4. 在 Remote Host 添加用于远程登陆的用户账号 如 bill

  [root@Remote root]# useradd bill

  [root@Remote root]# passwd bill

  5. 以bill登陆到 Remote Host 上

  [bill@Remote local]$ ssh-keygen

  Generating 1024-bit dsa key pair

  9 o.oOo..oOo.o

  Key generated.

  1024-bit dsa, created by bill@Local Wed Sep 23 07:11:02 1998

  Passphrase :输入一些字符,不超过20个

  Again :重复输入一遍

  Private key saved to /home/bill/.ssh2/id_dsa_1024_a

  6. 以bill登陆到 Local Host

  [bill@Local local]$ cd ~

  [bill@Local local]$ cp ./.ssh2/id_dsa_1024_a.pub Local.pub

  以bill ftp Remote Host

  [bill@local bill]$ ftp local

  ftp> lcd ~/.ssh2

  ftp> cd ~/.ssh2

  ftp> put Local.pub

  ftp> bye

  以bill Telnet Remote Host

  [bill@local bill]$ telnet local

  [bill@remote bill]$ cd ~/.ssh2

  [bill@remote .ssh2]$echo "Key Local.pub" > authorization

  测试

  在Local Host

  [bill@local bill]$ ssh Remote

  Passphrase for key "/home/bill/.ssh2/id_dsa_1024_a" with comment "1024-bit d: 输入前面输入的一些字符

  Authentication successful.

  [bill@Remote bill]$ netstat -n

  Active Internet connections (w/o servers)

  Proto Recv-Q Send-Q Local Address Foreign Address State

  tcp 0 252 192.168.1.222:22 192.168.1.223:3532 ESTABLISHED

  Active UNIX domain sockets (w/o servers)

  Proto RefCnt Flags Type State I-Node Path

  unix 9 [ ] DGRAM 436 /dev/log

  unix 0 [ ] STREAM CONNECTED 177 @00000016

  unix 0 [ ] DGRAM 771

  unix 0 [ ] DGRAM 753

  unix 0 [ ] DGRAM 672

  unix 0 [ ] DGRAM 636

  unix 0 [ ] DGRAM 590

  unix 0 [ ] DGRAM 575

  unix 0 [ ] DGRAM 523

  unix 0 [ ] DGRAM 458

  unix 0 [ ] DGRAM 446

  [bill@local bill]$ sftp Remote

  Passphrase for key "/home/bill/.ssh2/id_dsa_1024_a" with comment "1024-bit d:

  sftp> ls -l

  drwxr-xr-x 5 bill bill 4096 Jul 12 6:29 Desktop/

  -rwxr-xr-x 1 bill bill 333 Jul 12 6:29 .emacs*

  -rw-r--r-- 1 bill bill 24 Jul 12 6:29 .bash_logout

  -rw-r--r-- 1 bill bill 230 Jul 12 6:29 .bash_profile

  -rw-r--r-- 1 bill bill 124 Jul 12 6:29 .bashrc

  drwxr-xr-x 3 bill bill 4096 Jul 12 6:29 .kde/

  -rw-r--r-- 1 bill bill 435 Jul 12 6:29 .kderc

  -rw-r--r-- 1 bill bill 3394 Jul 12 6:29 .screenrc

  -rw------- 1 bill bill 316 Jul 12 16:31 .bash_history

  drwxr-xr-x 3 bill bill 4096 Jul 12 16:00 .ssh2/

  sftp>

  

上一个:Linux设置Squid的用户认证存取控制
下一个:Linux文件及目录的Suid/Guid和T属性

更多Unix/Linux疑问解答:
路由原理介绍
子网掩码快速算法
改变网络接口的速度和协商方式的工具miitool和ethtool
Loopback口的作用汇总
OSPF的童话
增强的ACL修改功能
三层交换机和路由器的比较
用三层交换机组建校园网
4到7层交换识别内容
SPARC中如何安装Linux系统(2)
SPARC中如何安装Linux系统(1)
用Swatch做Linux日志分析
实战多种Linux操作系统共存
浅析Linux系统帐户的管理和审计
Linux2.6对新型CPU的支持(2)
电脑通通透
玩转网络
IE/注册表
DOS/Win9x
Windows Xp
Windows 2000
Windows 2003
Windows Vista
Windows 2008
Windows7
Unix/Linux
苹果机Mac OS
windows8
安卓/Android
Windows10
如果你遇到操作系统难题:
访问www.zzzyk.com 试试
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,