How to use SSH in Ubuntu

Source: Internet
Author: User
Tags ssh account
There are two ways to achieve this: 1) install spawn and CT first. Run sudoapt-getinstallexpectspawn and input the following script to a text file, such as fanqiang. ssh :#! /Usr/bin/expectsettimeout60spawn/usr/bin/ssh-pserverport-D1 here there are two ways to achieve 1) first install spawn and CT. Run:
Sudo apt-get install verify CT spawn
Then input the following script into a text file, such as fanqiang. ssh:
#! /Usr/bin/expectset timeout 60 spawn/usr/bin/ssh-p Serverport-D 127.0.0.1: 7070-g username @ ServeripReset CT {"password:" {send" Password\ R "}}interact {timeout 60 {send ""}}
Then grant the execution permission:
Chmod + x fanqiang. ssh
Run the following command:
./Fanqiang. ssh
In this way, we have completed a redirection, but there is a drawback in this process, that is, it cannot be executed in the background. Once the shell window is closed, the corresponding process will end. Next we will introduce another method that can be executed in the background.
2) first install the required putty-tools Package and execute:
Sudo apt-get install putty-tools
Then write the following script into a file, such as fanqiang2.ssh:
Nohup plink-P Serverport-N Username@ Serverip-Pw Password-D 127.0.0.1: 7070 &
Then grant the execution permission:
Chmod + x fanqiang2.ssh
Run the following command:
./Fanqiang2.ssh
Now, even if we close the shell window, background processes still exist. It has no effect on us.
Note: The bold font involved in the code above indicates: ServeripIP address or domain name used to connect to the server ServerportPort connecting to the server UsernameUser Name of your SSH account PasswordYour SSH account password
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.