-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
136 lines (101 loc) · 5.77 KB
/
index.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8"/>
<title>Phil Rees</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href='http://fonts.googleapis.com/css?family=Alegreya:400italic,700italic,400,700' rel='stylesheet'
type='text/css'>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.1/styles/default.min.css">
<link href="css/screen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/index.html">Phil Rees</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
<li class="active" ><a href="/index.html">Home</a></li>
<li
><a href="/archives.html">Archives</a></li>
<li
>
<a href="/pages-output/about.html">About</a>
</li>
<li><a href="/feed.xml">RSS</a></li>
</ul>
</div><!--/.nav-collapse -->
</div><!--/.container-fluid -->
</nav>
<div class="container">
<div class="row">
<div class="col-lg-9">
<div id="content">
<div id="post">
<div class="post-header">
<div id="post-meta" class="row">
<div class="col-lg-6">January 21, 2016</div>
</div>
<h2>SSH time saver</h2>
</div>
<div>
<p>If you use SSH frequently then this might be useful. And if you use ssh infrequently then this might be even more useful. SSH is one of the most common ways to get access to a unix based server. If you are in IT or development you likely have access to several servers that all have their own dedicated functions. On top of that, a lot of servers you use might not be under a DNS and their is no convient domain name to use when logging in; instead there is just an IP.</p><p>If you are comfortable on the linux cli you have likely come across how to make and add aliases to your environment. This is one way to save your credientials. For example adding this:</p><pre><code>alias ll='ls -al'
alias myserver='ssh [email protected]'
</code></pre>to your bashrc file (<code>~/.bashrc</code>) will let you log into this server by just typing <code>myserver</code>.<p>The first alias here shows how you can alias any command. The second here we have alias <code>myserver</code> to now execute the following command and therefore log us in via ssh.</p><p>This works well for a lot of bash commands and even ssh commands. However once you have a lot of ssh options and parameters it can become a bit unwieldy.</p><h3><a name="ssh_config"></a>SSH Config</h3><p>The solution is simple. This file <code>~/.ssh/config</code> can store all our connections and settings. Here is how:</p><pre><code>Host prod
HostName myserver
Port 22
User root
</code></pre><p>Now we can reference the name of our host to login: <code>ssh prod</code> and we should be logged in.</p><h3><a name="even_more"></a>Even more</h3>There is a lot more you can do with a ssh config file. This is just the basics. To get more I would suggest you checkout the man pages for ssh_config <code>man ssh_config</code>.
</div>
<div id="post-tags">
<b>Tags: </b>
<a href="/tags-output/linux.html">linux</a>
<a href="/tags-output/ssh.html">ssh</a>
</div>
<div id="comments">
<a href="/posts-output/2016-01-21-ssh.html#disqus_thread">View Comments</a>
</div>
<div id="prev-next">
<a class="right" href="/posts-output/2016-01-07-first.html">First post »</a>
</div>
</div>
</div>
</div>
<div class="col-md-3">
<div id="sidebar">
<div id="recent">
<h3>Recent Posts</h3>
<ul>
<li><a href="/posts-output/2016-01-21-ssh.html">SSH time saver</a></li>
<li><a href="/posts-output/2016-01-07-first.html">First post</a></li>
</ul>
</div>
<div id="tags">
<h3>Tags</h3>
<ul>
<li><a href="/tags-output/linux.html">linux</a></li>
<li><a href="/tags-output/ssh.html">ssh</a></li>
</ul>
</div>
</div>
</div>
</div>
<footer>Copyright © Phil Rees
<p style="text-align: center;">Powered by <a href="http://cryogenweb.org">Cryogen</a></p></footer>
</div>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script src="js/highlight.pack.js" type="text/javascript"></script>
<script>hljs.initHighlightingOnLoad();</script>
</body>
</html>