Ubuntu SSH connection, remote upload download file

Source: Internet
Author: User
Tags openssh server rsync scp command dns spoofing

Transferred from: http://www.cnblogs.com/by-1075324834/p/5045096.html

Install the SSH (Secure Shell) service to provide remote management services

SSH Remote login Ubuntu machine

ssh [email  protected]

file/folder from remote Ubuntu machine Copy to local (SCP)

scp-r [email  protected]:/home/username/remotefile.txt.



(1) Under the local terminal, not on the server. Local files can be copied to the server on the local terminal.
(2)
scp -r 从本地要上传的完整路径到文件名 [email protected]:/home/username/

which
1) SCP is the command,-R is the parameter (to pass the file, plus-R)
2) Username is the server account
3) 192.168.0.1 is the server IP address to upload
4)/home/username/is the folder path to be copied into

For example: to upload the file name assignment1 to the server: The file is located in the exact path of/home/username1/downloads/assignment1 (you can go to the path of the file, enter the command: PWD, display the current path.) therefore

scp[]-r[]/home/username1/downloads/assignment1[][email protected]:/home/username/



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

rsync-v-u-a--delete--rsh=ssh--stats [email protected]:/home/username/remotefile.txt.

copy files/folders from local to the remote Ubuntu machine (rsync)

rsync-v-u-a--delete--rsh=ssh--stats localfile.txt [email protected]:/home/username/

telnet to an Ubuntu machine on a Windows machine with SSH

Download PuTTY


How to copy files/folders from/To a remote Ubuntu machine on a Windows machine

Download FileZilla

ssh-x [email protected]

support SSH GUI. In other words, gedit Open and save are operating on the server side. Nautilus Open the server-side file manager. This is much more convenient than just using the command line. Do not know the Putty support under Windows does not.

ssh-x [email protected] LS

executes the LS return result directly on the server side to the client



How to restrict user accounts that are connected remotely via SSH

For example, if you enable the SSH service, any user with a valid account can connect remotely. This may lead to some security issues because some remote password cracking tools can try common username/password

backing up the configuration file for the SSH service

sudo cp/etc/ssh/sshd_config/etc/ssh/sshd_config. ORIGINAL

Editing a configuration file

sudo gedit/etc/ssh/sshd_config

* Change the parameter permitrootlogin from Yes to No. The superuser cannot be directly online through the remote.
* Add parameter Allowusers set the user name of the remote connection (separated by a space).
* You can also use denyusers for fine-grained selection of users.
* If you enable the OpenSSH server and you has no intention for now to enable remote connections, you may add Allowus ERs nosuchuserhere to disable anyone connecting.


SSH Command

the SSH command can be used to execute commands on a remote machine without a shell prompt to log on. Its syntax format is: SSH hostname command. For example, if you want to execute the ls/usr/share/doc command on the remote host penguin.example.net, type the following command at the shell prompt:

ssh penguin.example.net Ls/usr/share/doc

3.2. Using the SCP command

The SCP command can be used to transfer files between machines through secure, encrypted connections. It is similar to RCP.

the general syntax for transferring local files to a remote system is:

SCP localfile [email protected]:/newfilename

LocalFile Specify the source file, [email protected]:/newfilename Specify the destination file.

to transfer the local file Shadowman to your account on Penguin.example.net, type (replace the username with your username) at the shell prompt:

SCP Shadowman [email protected]:/home/username

This will transfer the local file Shadowman to the/home/username/shadowman file on Penguin.example.net.

the general syntax for transferring remote files to the local system is:

SCP [Email protected]:/remotefile/newlocalfile

remotefile Specifies the source file, Newlocalfile specifies the destination file.

The source file can consist of multiple files. For example, to transfer the contents of the directory/downloads to the existing uploads directory on the remote machine penguin.example.net, type the following command at the shell prompt:

scp/downloads/* [Email protected]:/uploads/

3.3. Using the SFTP command

the SFTP tool can be used to open a secure interactive FTP session. It is similar to FTP, except that it uses a secure, encrypted connection. Its general syntax is: sftp [email protected]. Once verified, you can use a set of commands similar to those used by FTP. Please refer to the SFTP manual page (man) for a list of these commands. To read the instructions page, execute the man sftp command at the shell prompt. The SFTP tool is only available for OpenSSH version 2.5.0p1.


SSH Concept

ssh means that the secure SHELL,SSH protocol family is developed by the network Working Group of the IETF (Internet Engineering Task force), The SSH protocol is a security protocol based on the application layer and the transport layer.

traditional Web services, such as FTP, pop, and telnet, are inherently insecure because they transmit data, user accounts, and user passwords in clear text over the network, and are vulnerable to an attack by a man-in-the-middle (man-in-the-middle) attack. Is that there is another person or a machine impersonating a real server to receive data from a user to the server, and then impersonating the user to pass the data to the real server.

SSH (Secure Shell) is the most reliable protocol to provide security for Telnet sessions and other network services at the moment. The use of SSH protocol can effectively prevent the information leakage in the remote management process. With SSH, all transmitted data can be encrypted, as well as prevent DNS spoofing and IP spoofing.
An additional benefit of SSH is that the transmitted data is compressed so that the transfer speed can be speeded up. SSH has many functions, which can replace Telnet and provide a secure "channel" for FTP, POP, and even PPP.

Ubuntu SSH connection, remote upload download file

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.