Introduction: How to Use SSH2 on Linux

Source: Internet
Author: User
Article Title: to talk about how to use SSH2 on Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
   Software acquisition
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
  
   Software Installation
Description: Remote Host Name: Remote (Server) 192.168.1.222
Local Host Name: Local (Client) 192.168.1.223
  
1 install Redhat6.2
  
2 install SSH2 Server (Remote Host)
  
Use RPM
[Root @ Remote root] # rpm-ivh ssh-commercial-server-2.2.0-2nox.i386.rpm
  
Use SOURCE
  
[Root @ Remote root] # tar xzvf ssh-2.2.0.tar.gz
# Cd ssh-2.2.0
#./Configure
# Make
# Make install
  
  
3 install SSH2 Clinet (Local Host)
  
[Root @ Local root] # rpm-ivh ssh-commercial-workstation-2.2.0-2.i386.rpm
  
   System Configuration
1. Start sshd on Remote Host
[Root @ Remote root]/usr/loca/sbin/sshd2
  
2. Add a user account on the Local Host, such as bill.
[Root @ Local root] useradd bill
[Root @ Local root] passwd bill
  
3. Create a public and private key for the user on the Client
Log on to the Local Host using bill
[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: enter up to 20 characters
Again: Repeated input
Private key saved to/home/bill/. ssh2/id_dsa_1024_a
  
4. Create a user authentication file on the Client
Log on to the Local Host using bill
[Bill @ Local local] $ cd ~ /. Ssh2
[Bill @ Local local] $ echo "IdKey id_dsa_1024_a"> identification
  
4. Add the user account used for Remote login on the Remote Host, such as bill
[Root @ Remote root] # useradd bill
[Root @ Remote root] # passwd bill
  
5. log on to the Remote Host with bill
[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: enter up to 20 characters
Again: Repeated input
Private key saved to/home/bill/. ssh2/id_dsa_1024_a
  
6. log on to the Local Host using bill
[Bill @ Local local] $ cd ~
[Bill @ Local local] $ cp./. ssh2/id_dsa_1024_a.pub Local. pub
  
Use bill ftp Remote Host
[Bill @ local bill] $ ftp local
  
Ftp> LCD ~ /. Ssh2
Ftp> cd ~ /. Ssh2
Ftp> put Local. pub
Ftp> bye
  
Use bill to Telnet Remote Host
[Bill @ local bill] $ telnet local
[Bill @ remote bill] $ cd ~ /. Ssh2
[Bill @ remote. ssh2] $ echo "Key Local. pub"> authorization
  
   Test
In the Local Host
  
[Bill @ local bill] $ ssh Remote
Passphrase for key "/home/bill/. ssh2/id_dsa_1024_a" with comment "1024-bit d: Enter the previous characters
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
For 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 4096 Jul 12 Desktop/
-Rwxr-xr-x 1 bill 333 Jul 12. emacs *
-Rw-r -- 1 bill 24 Jul 12 6:29. bash_logout
-Rw-r -- 1 bill 230 Jul 12. bash_profile
-Rw-r -- 1 bill 124 Jul 12. bashrc
Drwxr-xr-x 3 bill 4096 Jul 12. kde/
-Rw-r -- 1 bill 435 Jul 12. kderc
-Rw-r -- 1 bill 3394 Jul 12. screenrc
-Rw ------- 1 bill 316 Jul 12. bash_history
Drwxr-xr-x 3 bill 4096 Jul 12. ssh2/
Sftp>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.