How to install the ssh service and client in Ubuntu

Source: Internet
Author: User
Tags ssh server

Ssh is not installed in the newly installed Ubuntu system by default. If you have not installed the ssh service, but you cannot connect to ubuntu through ssh directly on the client, run the following command:

The Code is as follows: Copy code

$ Sudo apt-get install openssh-server

Install the SSH server and client

The Code is as follows: Copy code

Sudo apt-get install openssh-server openssh-client


Copy files/folders from remote Ubuntu to local (scp)

The Code is as follows: Copy code

Scp-r username@192.168.0.1:/home/username/remotefile.txt.

Copy files/folders from local computer to remote Ubuntu machine (scp)

The Code is as follows: Copy code

Scp-r localfile.txt username@192.168.0.1:/home/username/

Copy files/folders from a remote Ubuntu machine to a local machine (rsync)

The Code is as follows: Copy code

Rsync-v-u-a -- delete -- rsh = ssh -- stats username@192.168.0.1:/home/username/remotefile.txt.

Copy files/folders from local computer to remote Ubuntu machine (rsync)

The Code is as follows: Copy code

Rsync-v-u-a -- delete -- rsh = ssh -- stats localfile.txt username@192.168.0.1:/home/username/


It's super simple.

Other parameters

To enable the SSH service on the local machine, you need to install openssh-server:

The Code is as follows: Copy code
Sudo apt-get install openssh-server

Check whether sshserver is running:

The Code is as follows: Copy code

Ps-e | grep ssh

Run sshserver:

The Code is as follows: Copy code

Sudo/etc/init. d/ssh start

The ssh-server configuration file is located in/etc/ssh/sshd_config. You can customize the SSH service port.
The default port is 22. Restart the SSH service after the custom Port:

The Code is as follows: Copy code

Sudo/etc/init. d/ssh stop
Sudo/etc/init. d/ssh start

Log on to SSH:

The Code is as follows: Copy code

Ssh username @ localhost
The username is the user on the localhost machine and the password is required.

Disconnect:
Exit

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.