{"id":313679,"date":"2020-11-24T09:01:49","date_gmt":"2020-11-24T09:01:49","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=313679"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=313679","title":{"rendered":"\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e .bashrc \u0447\u0435\u0440\u0435\u0437 ssh \u0438 \u043a\u043e\u043d\u0441\u043e\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d \u0447\u0435\u0440\u0435\u0437 ssh \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043a\u0430\u043a \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c shell \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u0438\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445. \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 .bashrc \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u0430 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">[ -z &quot;$PS1&quot; ] &amp;&amp; return  sshb() {     scp ~\/.bashrc ${1}:     ssh $1 }  # the rest of the .bashrc alias c=cat ... <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c\u0438:<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<ul>\n<li>\u041c\u043e\u0436\u043d\u043e \u0437\u0430\u0442\u0435\u0440\u0435\u0442\u044c \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 .bashrc<\/li>\n<li>\u0412\u043c\u0435\u0441\u0442\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u044b \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c 2<\/li>\n<li>\u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u0442\u043e\u0436\u0435 2 \u0440\u0430\u0437\u0430<\/li>\n<li>\u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0434\u0440\u0435\u0441\u043e\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b<\/li>\n<\/ul>\n<p>  \u0423\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442:<\/p>\n<pre><code class=\"bash\">[ -z &quot;$PS1&quot; ] &amp;&amp; return  sshb() {     local ssh=&quot;ssh -S ~\/.ssh\/control-socket-$(tr -cd '[:alnum:]' &lt; \/dev\/urandom|head -c8)&quot;     $ssh -fNM &quot;$@&quot;     $ssh placeholder &quot;cat &gt;~\/.bash-ssh&quot; &lt;~\/.bashrc     $ssh &quot;$@&quot; -t &quot;bash --rcfile ~\/.bash-ssh -i&quot;     $ssh placeholder -O exit &gt;\/dev\/null 2&gt;&amp;1 }  # the rest of the .bashrc alias c=cat ... <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0437\u0430 \u0441\u0447\u0435\u0442 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. .bashrc \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f bash \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0438 \u043c\u044b \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0446\u0438\u044e &#8212;rcfile. \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0434\u0440\u0435\u0441 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b, \u043d\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043e\u043f\u0446\u0438\u0438 ssh.<\/p>\n<p>  \u041d\u0430 \u044d\u0442\u043e\u043c \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c\u0441\u044f, \u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0431\u043b\u0430\u0434\u0430\u0435\u0442 \u043d\u0435\u043f\u0440\u0438\u044f\u0442\u043d\u044b\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c. \u0415\u0441\u043b\u0438 \u0432\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 screen \u0438\u043b\u0438 tmux, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u0442 .bashrc, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u0432\u0441\u0435 \u0432\u0430\u0448\u0438 \u0430\u043b\u0438\u0430\u0441\u044b \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u0442\u0435\u0440\u044f\u044e\u0442\u0441\u044f. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0431\u043e\u0440\u043e\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442-\u043e\u0431\u0435\u0440\u0442\u043a\u0443, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u043e\u0431\u044a\u044f\u0432\u0438\u043c \u043d\u0430\u0448\u0438\u043c \u043d\u043e\u0432\u044b\u043c \u0448\u0435\u043b\u043b\u043e\u043c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, \u0447\u0442\u043e \u0441\u043a\u0440\u0438\u043f\u0442-\u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u0438 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 ~\/bin\/bash-ssh. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a::<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash exec \/bin\/bash --rcfile ~\/.bash-ssh \u201c$@\u201d <\/code><\/pre>\n<p>  \u0410 .bashrc \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">[ -n &quot;$SSH_TTY&quot; ] &amp;&amp; export SHELL=&quot;$HOME\/bin\/bash-ssh&quot;  [ -z &quot;$PS1&quot; ] &amp;&amp; return  sshb() {     local ssh=&quot;ssh -S ~\/.ssh\/control-socket-$(tr -cd '[:alnum:]' &lt; \/dev\/urandom|head -c8)&quot;     $ssh -fNM &quot;$@&quot;     $ssh placeholder &quot;cat &gt;~\/.bash-ssh&quot; &lt;~\/.bashrc     $ssh &quot;$@&quot; -t &quot;bash --rcfile ~\/.bash-ssh -i&quot;     $ssh placeholder -O exit &gt;\/dev\/null 2&gt;&amp;1 }  # the rest of the .bashrc alias c=cat ... <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f SSH_TTY \u043c\u044b \u043f\u043e\u043d\u0438\u043c\u0430\u0435\u043c, \u0447\u0442\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0438 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e SHELL. \u0421 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0448\u0435\u043b\u043b\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u0441\u043a\u0440\u0438\u043f\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u0430\u0442\u044c bash \u0441 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0438 ssh \u0441\u0435\u0441\u0441\u0438\u0438.<\/p>\n<p>  \u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0441\u043a\u0440\u0438\u043f\u0442-\u043e\u0431\u0435\u0440\u0442\u043a\u0443. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c\u043e\u043c \u043d\u0430\u043c\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u0431\u0430\u0448\u0430 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">[ -n &quot;$SSH_TTY&quot; ] &amp;&amp; {     mkdir -p &quot;$HOME\/bin&quot;     export SHELL=&quot;$HOME\/bin\/bash-ssh&quot;     echo -e '#!\/bin\/bash\\nexec \/bin\/bash --rcfile ~\/.bash-ssh &quot;$@&quot;' &gt;$SHELL     chmod +x $SHELL } <\/code><\/pre>\n<p>  \u041d\u043e \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u0444\u0430\u0439\u043b\u043e\u043c ~\/.bash-ssh:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  [ -n &quot;$SSH_TTY&quot; ] &amp;&amp; [ &quot;${BASH_SOURCE[0]}&quot; == &quot;${0}&quot; ] &amp;&amp; exec bash --rcfile &quot;$SHELL&quot; &quot;$@&quot;  [ -z &quot;$PS1&quot; ] &amp;&amp; return  sshb() {     local ssh=&quot;ssh -S ~\/.ssh\/control-socket-$(tr -cd '[:alnum:]' &lt; \/dev\/urandom|head -c8)&quot;     $ssh -fNM &quot;$@&quot;     $ssh placeholder &quot;cat &gt;~\/.bash-ssh&quot; &lt;~\/.bashrc     $ssh &quot;$@&quot; -t 'SHELL=~\/.bash-ssh; chmod +x $SHELL; bash --rcfile $SHELL -i'     $ssh placeholder -O exit &gt;\/dev\/null 2&gt;&amp;1 }   # the rest of the .bashrc alias c=cat ... <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0444\u0430\u0439\u043b ~\/.bash-ssh \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u043c bash. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u044d\u0442\u043e \u0442\u0430\u043a. \u041d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043f\u043e\u0441\u043b\u0435 [ -n &quot;$SSH_TTY&quot; ] \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u041d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f sshb \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u0444\u0430\u0439\u043b ~\/.bash-ssh \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u043a\u0430\u043a \u043a\u043e\u043d\u0444\u0438\u0433 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0435\u0441\u0441\u0438\u0438. \u041a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f [ &quot;${BASH_SOURCE[0]}&quot; == &quot;${0}&quot; ] \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u0438\u043b\u0438 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043a\u0430\u043a \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u043a\u043e\u0433\u0434\u0430 ~\/.bash-ssh \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f  <\/p>\n<ul>\n<li>\u043a\u0430\u043a \u043a\u043e\u043d\u0444\u0438\u0433 \u2014 exec \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f<\/li>\n<li>\u043a\u0430\u043a \u0441\u043a\u0440\u0438\u043f\u0442 \u2014 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0431\u0430\u0448\u0443 \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 ~\/.bash-ssh \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c exec-\u043e\u043c.<\/li>\n<\/ul>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438 \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0435 \u043f\u043e ssh \u0432\u0430\u0448\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0432\u0435\u0437\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e. \u0422\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u043d\u043e \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u043c\u0430\u043d\u0434 \u0431\u0443\u0434\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u044b \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u043b\u0438\u0441\u044c. \u041b\u0438\u0447\u043d\u043e \u043c\u043d\u0435 \u0431\u044b \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u0441\u0432\u0435\u0436\u0438\u0442\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438, \u0447\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u044f \u0434\u0435\u043b\u0430\u043b \u043d\u0430 \u043a\u0430\u043a\u0438\u0445-\u0442\u043e \u043c\u0430\u0448\u0438\u043d\u0430\u0445 \u0432 \u043f\u0440\u043e\u0448\u043b\u043e\u043c. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b:  <\/p>\n<ul>\n<li>Tcp \u0441\u0435\u0440\u0432\u0435\u0440 \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u043e\u043a\u0435\u0442\u0430 \u0438 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u044f\u043b \u0438\u0445 \u0432 \u0444\u0430\u0439\u043b<\/li>\n<li>\u0424\u043e\u0440\u0432\u0430\u0440\u0434 \u0441\u043b\u0443\u0448\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u0440\u0442\u0430 \u044d\u0442\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043d\u0430 \u043c\u0430\u0448\u0438\u043d\u0443, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0438\u043c\u0441\u044f \u043f\u043e ssh<\/li>\n<li>PROMPT_COMMAND \u0432 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\u0445 bash, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u043b \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u0441\u0442\u043e\u0440\u0438\u0438 \u043d\u0430 \u043e\u0442\u0444\u043e\u0440\u0432\u0430\u0440\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442<\/li>\n<\/ul>\n<p>\u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"bash\">#!\/bin\/bash  [ -n &quot;$SSH_TTY&quot; ] &amp;&amp; [ &quot;${BASH_SOURCE[0]}&quot; == &quot;${0}&quot; ] &amp;&amp; exec bash --rcfile &quot;$SHELL&quot; &quot;$@&quot;  [ -z &quot;$PS1&quot; ] &amp;&amp; return  [ -z &quot;$SSH_TTY&quot; ] &amp;&amp; {     history_port=26574     netstat -lnt|grep -q &quot;:${history_port}\\b&quot; || {         umask 077 &amp;&amp; nc -kl 127.0.0.1 &quot;$history_port&quot; &gt;&gt;~\/.bash_eternal_history &amp;     } }  HISTSIZE=$((1024 * 1024)) HISTFILESIZE=$HISTSIZE HISTTIMEFORMAT='%t%F %T%t'  update_eternal_history() {     local histfile_size=$(stat -c %s $HISTFILE)     history -a     ((histfile_size == $(stat -c %s $HISTFILE))) &amp;&amp; return     local history_line=&quot;${USER}\\t${HOSTNAME}\\t${PWD}\\t$(history 1)&quot;     local history_sink=$(readlink ~\/.bash-ssh.history 2&gt;\/dev\/null)     [ -n &quot;$history_sink&quot; ] &amp;&amp; echo -e &quot;$history_line&quot; &gt;&quot;$history_sink&quot; 2&gt;\/dev\/null &amp;&amp; return     local old_umask=$(umask)     umask 077     echo -e &quot;$history_line&quot; &gt;&gt; ~\/.bash_eternal_history     umask $old_umask }  [[ &quot;$PROMPT_COMMAND&quot; == *update_eternal_history* ]] || export PROMPT_COMMAND=&quot;update_eternal_history;$PROMPT_COMMAND&quot;  sshb() {     local ssh=&quot;ssh -S ~\/.ssh\/control-socket-$(tr -cd '[:alnum:]' &lt; \/dev\/urandom|head -c8)&quot;     $ssh -fNM &quot;$@&quot;     local bashrc=~\/.bashrc     [ -r ~\/.bash-ssh ] &amp;&amp; bashrc=~\/.bash-ssh &amp;&amp; history_port=$(basename $(readlink ~\/.bash-ssh.history))     local history_remote_port=&quot;$($ssh -O forward -R 0:127.0.0.1:$history_port placeholder)&quot;     $ssh placeholder &quot;cat &gt;~\/.bash-ssh; ln -nsf \/dev\/tcp\/127.0.0.1\/$history_remote_port ~\/.bash-ssh.history&quot; &lt; $bashrc     $ssh &quot;$@&quot; -t 'SHELL=~\/.bash-ssh; chmod +x $SHELL; bash --rcfile $SHELL -i'     $ssh placeholder -O exit &gt;\/dev\/null 2&gt;&amp;1 }  # the rest of the .bashrc alias c=cat ... <\/code><\/pre>\n<p>  \u0411\u043b\u043e\u043a \u043f\u043e\u0441\u043b\u0435 [ -z &quot;$SSH_TTY&quot; ] \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u0435. \u041c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0437\u0430\u043d\u044f\u0442 \u043b\u0438 \u043f\u043e\u0440\u0442 \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430 \u043d\u0435\u043c netcat, \u0432\u044b\u0432\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u0432 \u0444\u0430\u0439\u043b.<\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f update_eternal_history \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u043d\u0430 \u044d\u043a\u0440\u0430\u043d \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438 bash. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0435 \u0431\u044b\u043b\u0430 \u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u0443\u0431\u043b\u0438\u043a\u0430\u0442\u043e\u043c \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0435 \u043d\u0430 \u043e\u0442\u0444\u043e\u0440\u0432\u0430\u0440\u0436\u0435\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u0442. \u0415\u0441\u043b\u0438 \u043f\u043e\u0440\u0442 \u043d\u0435 \u0441\u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u043d (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b) \u0438\u043b\u0438 \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438\u0434\u0435\u0442 \u0432 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b.<\/p>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u043b\u0430\u0441\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0444\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u043d\u0433\u0430 \u043f\u043e\u0440\u0442\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435\u043c \u0441\u0438\u043c\u043b\u0438\u043d\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f update_eternal_history \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440.<\/p>\n<p>  \u042d\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043d\u0435 \u043b\u0438\u0448\u0435\u043d\u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u0432:  <\/p>\n<ul>\n<li>\u041f\u043e\u0440\u0442 \u0434\u043b\u044f netcat \u0437\u0430\u0445\u0430\u0440\u0434\u043a\u043e\u0436\u0435\u043d, \u0435\u0441\u0442\u044c \u0448\u0430\u043d\u0441 \u043d\u0430\u0440\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0444\u043b\u0438\u043a\u0442<\/li>\n<li>\u0424\u043e\u0440\u0432\u0430\u0440\u0434 \u043f\u043e\u0440\u0442\u0430 \u0434\u0430\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043b\u044e\u0431\u043e\u043c\u0443 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0443 \u0441\u043e \u0437\u043b\u044b\u043c\u0438 \u043d\u0430\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u043c\u0438 \u0437\u0430\u0441\u043f\u0430\u043c\u0438\u0442\u044c \u0432\u0430\u0448\u0443 \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043c\u0443\u0441\u043e\u0440\u043d\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0437\u0434\u0430\u0435\u0442\u0435 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 (\u043c\u0430\u0448\u0438\u043d\u0430 \u0410-\u043c\u0430\u0448\u0438\u043d\u0430 \u0411-\u043c\u0430\u0448\u0438\u043d\u0430 \u0412), \u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u0412 \u043d\u0430 \u0410, \u043d\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043e\u0431\u0440\u044b\u0432\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0410 \u0438 \u0411 \u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0411 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0444\u043e\u0440\u0432\u0430\u0440\u0434\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439 \u043f\u043e\u0440\u0442 \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0412 \u043d\u0435 \u0434\u043e\u0441\u0442\u0438\u0433\u043d\u0443\u0442 \u0410, \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u0411<\/li>\n<\/ul>\n<p>  \u041c\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 .bashrc \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/github.com\/kt97679\/misc\/blob\/master\/.bashrc\" rel=\"nofollow\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0438\u0434\u0435\u0438 \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430 \u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445.<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/529544\/\"> https:\/\/habr.com\/ru\/post\/529544\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\">\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d \u0447\u0435\u0440\u0435\u0437 ssh \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043a\u0430\u043a \u0443\u043d\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c shell \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u044d\u0442\u0438\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445. \u041a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0437\u0430\u0440\u0430\u043d\u0435\u0435 .bashrc \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e, \u0430 \u0437\u0430\u0447\u0430\u0441\u0442\u0443\u044e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u043f\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"bash\">[ -z &quot;$PS1&quot; ] &amp;&amp; return  sshb() {     scp ~\/.bashrc ${1}:     ssh $1 }  # the rest of the .bashrc alias c=cat ... <\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u0438\u0432\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0441 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0430\u043c\u0438:  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-313679","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313679","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=313679"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/313679\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313679"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313679"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313679"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}