openssh mysql_§6-1 OpenSSH 的简介, ssh 和scp的使用

§6 OpenSSH

表6-1.本章重要的OpenSSH程序和文件

客户端程序

ssh

远程登陆和远程命令执行

scp

拷贝文件

sftp

交互式拷贝文件,类似FTP

服务器程序

sshd

服务器后台进程

创建和使用密钥的程序

ssh-keygen

创建和修改公钥和私钥

ssh-agent

缓存SSH私钥,

ssh-add

操作key cache of ssh-agent

重要的文件和目录

~/.ssh

存储密钥及其配置文件

/etc/ssh

密钥及其配置文件的系统配置目录

~/.ssh/config

客户端配置文件

/etc/ssh/ssh_config

客户端配置文件(系统级)

以上可能适用于其他的ssh,比如SSH Secure

Shell更多信息可参考< SSH, The Secure Shell: The Definitive

Guide (O'Reilly).>

§6.1登陆到远程计算机

当前用户是root,常用的登陆方式:

# ssh 10.50.44.88

# ssh -l meil 10.50.44.88

参数如下:

usage: man [-adfhktwW] [section] [-M path]

[-P pager] [-S list]

[-m system] [-p string] name ...

a :

find all matching entries

c :

do not use cat file

d :

print gobs of debugging information

D :

as for -d, but also display the pages

f :

same as whatis(1)

h :

print this help message

k :

same as apropos(1)

K :

search for a string in all pages

t :

use troff to format pages for printing

w :

print location of man page(s) that would be displayed

(if no name given: print directories that would be searched)

W :

as for -w, but display filenames only

C

file: use `file' as configuration file

M

path: set search path for manual pages

to `path'

P

pager: use program `pager' to display

pages

S

list: colon separated section list

m

system : search for alternate system's man pages

p

string : string tells which preprocessors to run

e - [n]eqn(1)p - pic(1)t - tbl(1)

g - grap(1)r - refer(1)v - vgrind(1)

更多信息参考:

§6.2调用远程程序

非交互式程序可以这样执行,不会建立login会话

[root@Meil89 sda1]# ssh10.50.44.88

uptime

root@10.50.44.88's

password:

12:04:21up 7 days, 13:58,1 user,load average: 0.00, 0.00, 0.00

交互式程序可这样执行, -t使SSH分配一个pseudo-tty,以下如果不是用”-t”将不能编辑,多见于基于文本的终端和游戏.

ssh10.50.44.88

-t vi test.sh

图形相关可以这样执行:比如打开远程的终端窗口

ssh -X -f server.example.com xterm

要确认远程端,没有设置DISPLAY, SSH会自动设置为正确的值,一般在bash_profile or .bashrc和/etc/profile(全局)可设置,也有可能使/etc/ssh/sshd_config中没有打开X11Forwarding

§6.3拷贝远程文件

scp -rp ./* meil@10.50.44.89:./tmp

Scp最常用的参数为-r递归,包含目录, -p保持原有属性

使用以下,

rsync -a -e ssh . 10.50.44.89:/root/tmp

有如下好处,

避免scp拷贝符号连接,以及不管文件在不在都进行拷贝.

加-v可以显示详细信息.

rsync -a -e ssh -v . 10.50.44.89:/root/tmp

参数如下:

man, version 1.5k

usage: man [-adfhktwW] [section] [-M path]

[-P pager] [-S list]

[-m system] [-p string] name ...

a :

find all matching entries

c :

do not use cat file

d :

print gobs of debugging information

D :

as for -d, but also display the pages

f :

same as whatis(1)

h :

print this help message

k :

same as apropos(1)

K :

search for a string in all pages

t :

use troff to format pages for printing

w :

print location of man page(s) that would be displayed

(if no name given: print directories that would be searched)

W :

as for -w, but display filenames only

C

file: use `file' as configuration file

M

path: set search path for manual pages

to `path'

P

pager: use program `pager' to display

pages

S

list: colon separated section list

m

system : search for alternate system's man pages

p

string : string tells which preprocessors to run

e - [n]eqn(1)p - pic(1)t - tbl(1)

g - grap(1)r - refer(1)v - vgrind(1)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值