Linux SSH service operations u

Source: Internet
Author: User

I. Password-based authentication

[email protected] ~]# cat ~/.ssh/known_hosts

Cat:/root/.ssh/known_hosts:no such file or directory

[Email protected] ~]# ls-l ~/-A

Total 14264

Dr-xr-x---. 3 root root 4096 June 26 19:08.

Dr-xr-xr-x. Root root 4096 June 28 17:25.

Drwx-wx-wx. 2 root root 4096 June 14:06 044dir

-rw--w--w-. 1 root root 0 June 14:09 044file

-RW-------. 1 root root 1119 June 8 19:36 Anaconda-ks.cfg

。。。。。。。。。。 # # #没有ssh

[Email protected] ~]# ssh-p22 [email protected] # #ssh-P port number remote host user @ remote host IP

The authenticity of host ' 192.168.21.132 (192.168.21.132) ' can ' t be established.

RSA key fingerprint is 0d:83:2a:1e:5d:e5:b7:1f:bf:9e:65:45:25:7b:77:59.

Is you sure want to continue connecting (yes/no)? yes# #输入yes

warning:permanently added ' 192.168.21.132 ' (RSA) to the list of known hosts.

[email protected] ' s password: # # # # #密码

Last login:tue June 20:14:59 from 192.168.21.1

[Email protected] ~]# Logout

Connection to 192.168.21.132 closed. # #远程主机关闭

[email protected] ~]# Cat ~/.ssh/known_hosts # #当前主机

192.168.21.132 Ssh-rsa aaaab3nzac1yc2eaaaabiwaaaqeatyd5b2bsosmj1d6cbkpotfvrp+zbg1/6mc8po13u+ o5254tnxwcnmrzqehzjrylxyasskbrpv9ogi+r6jx9kxmo40vus5cdjvsq1bxldp3y4a6wrzvgd/ jiseyhosqylo19kedc1pko6utblohdj2tuxmd5dmkk+ hhxvahtt5zngbheljpnhighbxicioptibsraez7rfxssr9tk4aanex46tczb9ph6wkfjgd+iaphlfxfbfcfh1dk3c7g+ xg8rpkd0jzjwwwesltfzdtt0tm0xmjxav0rlolsv5mkjs+hscbsdzl0jkpktijfw1zkr4ccbowwmu7qt9fwsejp9hq==

[Email protected] ~]#


Two. Do not log on to the remote host and execute commands directly on the remote host

[Email protected] ~]# ssh-p22 [email protected]/sbin/ifconfig

[email protected] ' s password:

Eth0 Link encap:ethernet HWaddr 00:0c:29:2c:3d:b3

inet addr:192.168.21.132 bcast:192.168.21.255 mask:255.255.255.0


Three.

(a): 1 2####### Copy File

1. Push push:

[Email protected] ~]# scp-p22/oldboy/b.txt [email protected]:/oldboy

Source (native) destination (remote server)

[email protected] ' s password:

B.txt 100% 0.0kb/s 00:00

[Email protected] ~]#

2. Push Pull:

[Email protected] ~]# scp-p22 [email protected]:/oldboy/newfile/oldboy

Target Source

[email protected] ' s password:

NewFile 100% 0 0.0kb/s 00:00


Two

[Email protected] oldboy]# scp-p22-r/oldboy/[email protected]:/oldboy2 ####### Copy directory parameter-r

[email protected] ' s password:


[Email protected]/]# sftp-oport=22 [email protected]

Connecting to 192.168.21.132 ...

[email protected] ' s password: ###### #密码

Sftp> put A.log # # #拷贝文件 sftp copy file with put

Uploading A.log To/root/a.log

A.log 100% 0.0kb/s 00:00

Sftp>


Three

The client side upload file is uploaded to the server home directory by default

[Email protected] oldboy7]# sftp-oport=22 [email protected]

Connecting to 192.168.21.128 ...

[email protected] ' s password:

Sftp> Put/oldboy7/oldboy7.txt

Uploading/oldboy7/oldboy7.txt To/root/oldboy7.txt

/oldboy7/oldboy7.txt 100% 0.0kb/s 00:00


Client side files can be uploaded to the server specified directory

Sftp> Put/oldboy7/oldboy7.txt/oldboy7

Uploading/oldboy7/oldboy7.txt To/oldboy7/oldboy7.txt

/oldboy7/oldboy7.txt 100% 0.0kb/s 00:00

Sftp>


The file on the client side download server is downloaded to the current directory

sftp> get/oldboy8/oldboy8.txt sftp download file file with get

Fetching/oldboy8/oldboy8.txt to Oldboy8.txt

Sftp> quit


The file on the client side download server is available to specify the download directory

[Email protected]/]# sftp-oport=22 [email protected]

Connecting to 192.168.21.128 ...

[email protected] ' s password:

Sftp> Get/oldboy8/oldboy8.txt/oldboy

Fetching/oldboy8/oldboy8.txt To/oldboy/oldboy8.txt


This article is from the "10900500" blog, please be sure to keep this source http://10910500.blog.51cto.com/10900500/1794570

Linux SSH service operations u

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.