


Today I will introduce to you several applications of ssh. Common applications include using ssh to connect to remote servers, using sftp to transfer files, and using ssh to perform off-site backups.
Connect to the remote host
Connect to the remote server This is our most commonly used function, connect to the remote server, and then manage the server .
If your client is windows, then you need to install terminal tools, such as xshell, Terminator, Tmux, etc., and then use these terminal tools to connect to the remote server. If the client is Linux, you can use the ssh command directly.
Commonly used command usage is given below
Connect to the remote host ssh [account@]IP [-p specified port]
Without logging in, directly send a command to the remote server to execute the ssh -f [account@]IP [-p specified port] command
The following demonstrates remote connection to the server
# ssh 121.196.12.64 The authenticity of host '121.196.12.64 (121.196.12.64)' can't be established. ECDSA key fingerprint is SHA256:wx0RHE8fcCoad6YKw0Ex4NE+QjwRiTYxC2s2g/DqPUU. ECDSA key fingerprint is MD5:43:2c:7a:12:24:1d:86:3a:b0:a0:b7:95:c2:cf:7b:ab. Are you sure you want to continue connecting (yes/no)?
When you connect for the first time, you will be asked if you want to connect, enter yes here. After entering yes, you will be asked to enter a password
root@121.196.12.64's password: Welcome to Alibaba Cloud Elastic Compute Service ! Activate the web console with: systemctl enable --now cockpit.socket Last login: Thu Nov 19 16:25:42 2020 from 114.103.36.247
When you enter the password correctly, you will successfully connect to the remote server.
When the public key of the remote host is accepted, it will be saved in the file $HOME/.ssh/known_hosts. The next time you connect to this host, the system will recognize that its public key has been saved locally, skip the warning part, and directly prompt you to enter the password.
Each SSH user has its own known_hosts file. In addition, the system also has such a file, usually /etc/ssh/ssh_known_hosts, which saves some public keys of remote hosts that are trustworthy to all users.
If you want to exit the login, enter exit and wait to log in
# exit logout Connection to 121.196.12.64 closed.
Simulate ftp file transfer method: SFTP
Using SSH is used to control the remote host. If you just want to download resources from the remote server or upload local files to the server, then use sftp or scp. These two commands are also through the ssh port.
Login through sftp
# sftp root@121.196.12.64 root@121.196.12.64's password: Connected to 121.196.12.64. sftp> ? <== 输入?可查看交互命令的帮助信息
There are many commands for the interactive mode of sftp. Here are some common interactive commands, viewed from the three categories.
Commands for the remote server: such as ls, pwd, mkdir, etc.
-
Commands for the local machine: lcd, lls, etc.
Commands for uploading and downloading: put (upload files), get (download files).
The upload and download operations are demonstrated below.
# 从远程服务器下载一个文件到本地 sftp> ls 1.txt install.sh sftp> get 1.txt Fetching /root/1.txt to 1.txt /root/1.txt 100% 6 0.0KB/s 00:00 sftp> lls 1.txt install.sh job1.php job2.php job3.php learnshell logrotate_learn.log logrotate_learn.log.1.gz # 上传本地文件到服务器上 sftp> put job1.php Uploading job1.php to /root/job1.php job1.php 100% 34 0.3KB/s 00:00 sftp> ls 1.txt install.sh job1.php
Off-site file transfer: SCP
The SCP command can be used for off-site backup. The simplest usage of SCP is as follows
# 上传文件 scp [-pr] [-l 速率] file [账号@]主机:目录名 # 下载文件 scp [-pr] [-l 速率] [账号@]主机:file 目录名
Options and parameters:
-p Keep file attributes
-r Recursive operation
-l Limit the rate, followed by a value; for example, 1024 means 1024k bytes/s
For the backup of important files, follow one principle "Never put all your eggs in one basket." In addition to local backup, we should also perform off-site backup. Frequently use the scp command plus the system's scheduled tasks to perform off-site backup, such as:
* 2 1 * * scp -rp root@101.*.*.185:/backup \ > /root/backup/scp_$(date +$Y%m%d) 1>/dev/null 2>&1
For more related technical articles, please visit the linux tutorial column!
The above is the detailed content of What functions does the ssh service have - logging into remote hosts, sftp, and off-site backup of files?. For more information, please follow other related articles on the PHP Chinese website!
![Windows 11 中的 Telnet 完整教程 [安装/启用和故障排除]](https://img.php.cn/upload/article/000/000/164/168476253791019.jpg)
<p>Telnet是“终端网络”的简称。它是用户可以用来将一台计算机连接到本地计算机的协议。</p><p>这里,本地计算机是指启动连接的设备,而连接到本地计算机的计算机称为远程计算机。</p><p>Telnet在客户端/服务器主体上运行,虽然它已经过时,但在2022年它仍然被许多人使用。许多人已经转向Windows11操作系统,这是微软提供的最新操作系统。&

如何从 iPad SSH 到 Mac这是一个两部分的演练。首先,您将在 Mac 上启用 SSH 服务器,然后您将使用 ssh 客户端应用程序从 iPad 连接到它。在 Mac 上,启动 SSH 服务器您可以通过打开名为 Remote Login 的功能在 Mac 上启用 SSH 服务器。转到 Apple 菜单 > 系统偏好设置 > 共享 > 启用“远程登录”,并选中“允许远程用户完全访问磁盘”框Mac 现在是一个 SSH 服务器,为您提供从 iPad 连接的 shell。注意

随着云计算和物联网的发展,远程操作服务器变得越来越重要。在Python中,我们可以使用Paramiko模块来轻松实现SSH远程操作。在本文中,我们将介绍Paramiko的基本用法,以及如何在Python中使用Paramiko来远程管理服务器。什么是ParamikoParamiko是一个用于SSHv1和SSHv2的Python模块,可以用于连接和控制SSH客户

背景如果需要访问远程服务器的Mysql数据库,但是该Mysql数据库为了安全期间,安全措施设置为只允许本地连接(也就是你需要登录到该台服务器才能使用),其他远程连接是不可以直接访问,并且相应的端口也做了修改,那么就需要基于ssh来连接该数据库。这种方式连接数据库与Navicat里面界面化基于ssh连接一样。Navicat连接数据库安装支持库如果要连接Mysql,首先需要安装pymysqlpipinstallpymysql安装基于ssh的库sshtunnelpipinstallsshtunnel#

linux自带有ssh。linux系统会自带ssh软件,默认就是OpenSSH相关软件包,并将ssh服务添加为开机自启动,可以通过“ssh -V”命令来查看安装的ssh版本信息。执行“systemctl start sshd”命令即可启动sshd服务,默认端口使用的22端口。

在进行服务器搭建或者系统管理时,CentOS7.9是一个非常常用的操作系统版本,本文将为您提供关于CentOS7.9安装以及安装SSH的详细步骤和说明。CentOS7.9是一个免费且开源的Linux操作系统,它是基于RedHatEnterpriseLinux(RHEL)的二进制兼容版本,下面是CentOS7.9安装的步骤:1.您需要下载CentOS7.9的ISO镜像文件,您可以从CentOS官方网站上下载最新的CentOS7.9ISO镜像文件。2.在您的计算机上创建一个新的虚拟机或者物理机,并将

Ansible工作原理从上面的图上可以了解到:管理端支持local、ssh、zeromq三种方式连接被管理端,默认使用基于ssh的连接,这部分对应上面架构图中的连接模块;可以按应用类型等方式进行HostInventory(主机清单)分类,管理节点通过各类模块实现相应的操作,单个模块,单条命令的批量执行,我们可以称之为ad-hoc;管理节点可以通过playbooks实现多个task的集合实现一类功能,如web服务的安装部署、数据库服务器的批量备份等。playbooks我们可以简单的理解为,系统通过

检查方法:1、用文本编辑器打开“/etc/ssh/sshd_config”,查看“Protocol”字段,若显示“Protocol 2”就代表服务器只支持SSH2,若显示“Protocol 1”就代表服务器同时支持两者。2、强制ssh使用特定的SSH协议,通过查看SSH服务器的响应来判断。3、使用scanssh工具,语法“sudo scanssh -s ssh ip地址”。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
