-
Notifications
You must be signed in to change notification settings - Fork 0
/
sshyuan-cheng-ming-ling-zhi-xing.html
executable file
·99 lines (88 loc) · 5.09 KB
/
sshyuan-cheng-ming-ling-zhi-xing.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!doctype html>
<html lang="">
<head>
<meta charset="utf-8"/>
<title>ssh远程命令执行 - Restart</title>
<meta name="author" content="wxz" />
<meta name="copyright" content="wxz" />
<meta property="og:site_name" content="Restart" />
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="ssh远程命令执行" />
<meta name="date" content="2021-10-14 17:20:00+08:00" />
<meta property="og:type" content="article" />
<meta property="og:locale" content="en" />
<meta property="og:published_time" content="2021-10-14 17:20:00+08:00" />
<meta property="og:title" content="ssh远程命令执行" />
<meta property="og:url" content="./sshyuan-cheng-ming-ling-zhi-xing.html" />
<meta property="og:description" content="比较不错介绍ssh远程命令的教程:http://www.zzvips.com/article/83454.html 所有远程命令执行之前需做好ssh免密登陆 - 本地执行远程主机的命令 # nc -z -v 58.128.97.87 61927 && if [ $? -eq 0 …" />
<meta name="description" content="比较不错介绍ssh远程命令的教程:http://www.zzvips.com/article/83454.html 所有远程命令执行之前需做好ssh免密登陆 - 本地执行远程主机的命令 # nc -z -v 58.128.97.87 61927 && if [ $? -eq 0 …" />
<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<link rel="icon" href="./favicon.ico" type="image/x-icon" />
<link href='https://fonts.googleapis.com/css?family=Droid+Sans:700,400|Droid+Sans+Mono' rel='stylesheet' type='text/css' />
<link rel="stylesheet" href="./theme/css/main.css" type="text/css" />
<!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<header class="clearfix" role="banner">
<div class="wrapper">
<h1 class="huge"><a href=".">Restart</a></h1>
</div>
</header>
<div role="main" class="content clearfix">
<article>
<div class="post wrapper">
<h1>ssh远程命令执行</h1>
<p>比较不错介绍ssh远程命令的教程:http://www.zzvips.com/article/83454.html</p>
<blockquote>
<blockquote>
<p>所有远程命令执行之前需做好ssh免密登陆
- 本地执行远程主机的命令</p>
</blockquote>
</blockquote>
<div class="highlight"><pre><span></span><code><span class="c1"># nc -z -v 58.128.97.87 61927 && if [ $? -eq 0 ];then ssh -p61927 58.128.97.87 'ls;pwd';fi</span>
Connection<span class="w"> </span>to<span class="w"> </span><span class="m">58</span>.128.97.87<span class="w"> </span><span class="m">61927</span><span class="w"> </span>port<span class="w"> </span><span class="o">[</span>tcp/*<span class="o">]</span><span class="w"> </span>succeeded!
anaconda-ks.cfg
install.log
install.log.syslog
/root
</code></pre></div>
<ul>
<li>本地远程执行主机上的一些脚本</li>
</ul>
<div class="highlight"><pre><span></span><code>nc<span class="w"> </span>-z<span class="w"> </span>-v<span class="w"> </span><span class="m">58</span>.128.97.87<span class="w"> </span><span class="m">61927</span><span class="w"> </span><span class="o">&&</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="o">[</span><span class="w"> </span><span class="nv">$?</span><span class="w"> </span>-eq<span class="w"> </span><span class="m">0</span><span class="w"> </span><span class="o">]</span><span class="p">;</span><span class="k">then</span><span class="w"> </span>ssh<span class="w"> </span>-p61927<span class="w"> </span><span class="m">58</span>.128.97.87<span class="w"> </span><span class="s1">'/etc/init.d/httpd stop'</span><span class="p">;</span><span class="k">fi</span>
Connection<span class="w"> </span>to<span class="w"> </span><span class="m">58</span>.128.97.87<span class="w"> </span><span class="m">61927</span><span class="w"> </span>port<span class="w"> </span><span class="o">[</span>tcp/*<span class="o">]</span><span class="w"> </span>succeeded!
停止<span class="w"> </span>httpd:<span class="o">[</span>确定<span class="o">]</span>
</code></pre></div>
<a href="https://twitter.com/share" class="twitter-share-button" data-via="" data-lang="en" data-size="large" data-related="">Tweet</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
<div class="meta wrapper">
<time datetime="2021-10-14T17:20:00+08:00" pubdate>Thu 14 October 2021</time>
<ul class="tag clearfix">
<li><a href="./category/page.html">page</a></li>
</ul>
</div> </article>
</div>
<footer class="clearfix">
<div class="wrapper pages">
<ul class="nav">
<li><a href="./archives.html">Archive</a></li>
</ul>
</div>
<div class="copy wrapper">
<ul class="social">
<li><a href="https://dianyi.ng/">You can add links in your config file</a></li>
<li><a href="#">Another social link</a></li>
</ul>
<p role="contentinfo"> © 2017 wxz
<br>
Proudly powered by <a href="http://alexis.notmyidea.org/pelican/">Pelican</a>.</p>
</div>
</footer>
</body>
</html>