Skip to content

Commit edacfb6

Browse files
committed
deploy: 47cd5af
1 parent 2797d38 commit edacfb6

File tree

4 files changed

+118
-118
lines changed

4 files changed

+118
-118
lines changed

search/search_index.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

sitemap.xml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,87 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url>
33
<loc>https://www.msys2.org/</loc>
4-
<lastmod>2020-04-16</lastmod>
4+
<lastmod>2020-04-17</lastmod>
55
<changefreq>daily</changefreq>
66
</url><url>
77
<loc>https://www.msys2.org/wiki/Using-packages/</loc>
8-
<lastmod>2020-04-16</lastmod>
8+
<lastmod>2020-04-17</lastmod>
99
<changefreq>daily</changefreq>
1010
</url><url>
1111
<loc>https://www.msys2.org/wiki/Mirrors/</loc>
12-
<lastmod>2020-04-16</lastmod>
12+
<lastmod>2020-04-17</lastmod>
1313
<changefreq>daily</changefreq>
1414
</url><url>
1515
<loc>https://www.msys2.org/wiki/Home/</loc>
16-
<lastmod>2020-04-16</lastmod>
16+
<lastmod>2020-04-17</lastmod>
1717
<changefreq>daily</changefreq>
1818
</url><url>
1919
<loc>https://www.msys2.org/wiki/Contributing-to-MSYS2/</loc>
20-
<lastmod>2020-04-16</lastmod>
20+
<lastmod>2020-04-17</lastmod>
2121
<changefreq>daily</changefreq>
2222
</url><url>
2323
<loc>https://www.msys2.org/wiki/Creating-Packages/</loc>
24-
<lastmod>2020-04-16</lastmod>
24+
<lastmod>2020-04-17</lastmod>
2525
<changefreq>daily</changefreq>
2626
</url><url>
2727
<loc>https://www.msys2.org/wiki/Devtopics/</loc>
28-
<lastmod>2020-04-16</lastmod>
28+
<lastmod>2020-04-17</lastmod>
2929
<changefreq>daily</changefreq>
3030
</url><url>
3131
<loc>https://www.msys2.org/wiki/Distributing/</loc>
32-
<lastmod>2020-04-16</lastmod>
32+
<lastmod>2020-04-17</lastmod>
3333
<changefreq>daily</changefreq>
3434
</url><url>
3535
<loc>https://www.msys2.org/wiki/FAQ/</loc>
36-
<lastmod>2020-04-16</lastmod>
36+
<lastmod>2020-04-17</lastmod>
3737
<changefreq>daily</changefreq>
3838
</url><url>
3939
<loc>https://www.msys2.org/wiki/GDB-qtcreator/</loc>
40-
<lastmod>2020-04-16</lastmod>
40+
<lastmod>2020-04-17</lastmod>
4141
<changefreq>daily</changefreq>
4242
</url><url>
4343
<loc>https://www.msys2.org/wiki/History/</loc>
44-
<lastmod>2020-04-16</lastmod>
44+
<lastmod>2020-04-17</lastmod>
4545
<changefreq>daily</changefreq>
4646
</url><url>
4747
<loc>https://www.msys2.org/wiki/How-does-MSYS2-differ-from-Cygwin/</loc>
48-
<lastmod>2020-04-16</lastmod>
48+
<lastmod>2020-04-17</lastmod>
4949
<changefreq>daily</changefreq>
5050
</url><url>
5151
<loc>https://www.msys2.org/wiki/Launchers/</loc>
52-
<lastmod>2020-04-16</lastmod>
52+
<lastmod>2020-04-17</lastmod>
5353
<changefreq>daily</changefreq>
5454
</url><url>
5555
<loc>https://www.msys2.org/wiki/MSYS2-installation/</loc>
56-
<lastmod>2020-04-16</lastmod>
56+
<lastmod>2020-04-17</lastmod>
5757
<changefreq>daily</changefreq>
5858
</url><url>
5959
<loc>https://www.msys2.org/wiki/MSYS2-introduction/</loc>
60-
<lastmod>2020-04-16</lastmod>
60+
<lastmod>2020-04-17</lastmod>
6161
<changefreq>daily</changefreq>
6262
</url><url>
6363
<loc>https://www.msys2.org/wiki/MSYS2-reinstallation/</loc>
64-
<lastmod>2020-04-16</lastmod>
64+
<lastmod>2020-04-17</lastmod>
6565
<changefreq>daily</changefreq>
6666
</url><url>
6767
<loc>https://www.msys2.org/wiki/Packages/</loc>
68-
<lastmod>2020-04-16</lastmod>
68+
<lastmod>2020-04-17</lastmod>
6969
<changefreq>daily</changefreq>
7070
</url><url>
7171
<loc>https://www.msys2.org/wiki/Porting/</loc>
72-
<lastmod>2020-04-16</lastmod>
72+
<lastmod>2020-04-17</lastmod>
7373
<changefreq>daily</changefreq>
7474
</url><url>
7575
<loc>https://www.msys2.org/wiki/Setting-up-SSHd/</loc>
76-
<lastmod>2020-04-16</lastmod>
76+
<lastmod>2020-04-17</lastmod>
7777
<changefreq>daily</changefreq>
7878
</url><url>
7979
<loc>https://www.msys2.org/wiki/Signing-packages/</loc>
80-
<lastmod>2020-04-16</lastmod>
80+
<lastmod>2020-04-17</lastmod>
8181
<changefreq>daily</changefreq>
8282
</url><url>
8383
<loc>https://www.msys2.org/wiki/Terminals/</loc>
84-
<lastmod>2020-04-16</lastmod>
84+
<lastmod>2020-04-17</lastmod>
8585
<changefreq>daily</changefreq>
8686
</url>
8787
</urlset>

sitemap.xml.gz

0 Bytes
Binary file not shown.

wiki/Setting-up-SSHd/index.html

Lines changed: 96 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -548,108 +548,108 @@
548548

549549
<h1>Setting up SSHd</h1>
550550

551-
<div class="highlight"><pre><span></span><code>#!/bin/sh
552-
#
553-
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
554-
#
555-
# Replaces ssh-host-config &lt;https://github.com/openssh/openssh-portable/blob/master/contrib/cygwin/ssh-host-config&gt;
556-
# Adapted from &lt;https://ghc.haskell.org/trac/ghc/wiki/Building/Windows/SSHD&gt; by Sam Hocevar &lt;sam@hocevar.net&gt;
557-
# Adapted from &lt;https://gist.github.com/samhocevar/00eec26d9e9988d080ac&gt; by David Macek
558-
#
559-
# Prerequisites:
560-
# — a 64-bit installation of MSYS2 itself: https://msys2.org
561-
# — some packages: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
562-
#
563-
# Gotchas:
564-
# — the log file will be /var/log/msys2_sshd.log
565-
# — if you get error “sshd: fatal: seteuid XXX : No such device or address”
566-
# in the logs, try “passwd -R” (with admin privileges)
567-
# — if you get error “chown(/dev/pty1, XXX, YYY) failed: Invalid argument”
568-
# in the logs, make sure your account and group names are detectable (see
569-
# `id`); issues are often caused by having /etc/{passwd,group} or having
570-
# a modified /etc/nsswitch.conf
571-
#
572-
# Changelog:
573-
# 16 Apr 2020 — remove additional privileged user
574-
# — only touch /etc/{passwd,group} if they exist
575-
# 27 Jun 2019 — rename service to msys2_sshd to avoid conflicts with Windows OpenSSH
576-
# — use mkgroup.exe as suggested in the comments
577-
# — fix a problem with CRLF and grep
578-
# 24 Aug 2015 — run server with -e to redirect logs to /var/log/sshd.log
579-
#
580-
581-
set -e
582-
583-
#
584-
# Configuration
585-
#
586-
587-
PRIV_USER=SYSTEM
588-
UNPRIV_USER=sshd # DO NOT CHANGE; this username is hardcoded in the openssh code
589-
UNPRIV_NAME=&quot;Privilege separation user for sshd&quot;
590-
591-
EMPTY_DIR=/var/empty
592-
593-
594-
#
595-
# Check installation sanity
596-
#
597-
598-
if ! /mingw64/bin/editrights -h &gt;/dev/null; then
599-
echo &quot;ERROR: Missing &#39;editrights&#39;. Try: pacman -S mingw-w64-x86_64-editrights.&quot;
600-
exit 1
601-
fi
602-
603-
if ! cygrunsrv -v &gt;/dev/null; then
604-
echo &quot;ERROR: Missing &#39;cygrunsrv&#39;. Try: pacman -S cygrunsrv.&quot;
605-
exit 1
606-
fi
607-
608-
if ! ssh-keygen -A; then
609-
echo &quot;ERROR: Missing &#39;ssh-keygen&#39;. Try: pacman -S openssh.&quot;
610-
exit 1
611-
fi
612-
613-
614-
#
615-
# The unprivileged sshd user (for privilege separation)
616-
#
617-
618-
add=&quot;$(if ! net user &quot;${UNPRIV_USER}&quot; &gt;/dev/null; then echo &quot;//add&quot;; fi)&quot;
619-
if ! net user &quot;${UNPRIV_USER}&quot; ${add} //fullname:&quot;${UNPRIV_NAME}&quot; \
620-
//homedir:&quot;$(cygpath -w ${EMPTY_DIR})&quot; //active:no; then
621-
echo &quot;ERROR: Unable to create Windows user ${PRIV_USER}&quot;
622-
exit 1
623-
fi
624-
625-
626-
#
627-
# Add or update /etc/passwd entries
628-
#
629-
630-
if test -f /etc/passwd; then
631-
sed -i -e &#39;/^&#39;&quot;${UNPRIV_USER}&quot;&#39;:/d&#39; /etc/passwd
632-
SED=&#39;/^&#39;&quot;${UNPRIV_USER}&quot;&#39;:/s?^\(\([^:]*:\)\{5\}\).*?\1&#39;&quot;${EMPTY_DIR}&quot;&#39;:/bin/false?p&#39;
633-
mkpasswd -l -u &quot;${UNPRIV_USER}&quot; | sed -e &#39;s/^[^:]*+//&#39; | sed -ne &quot;${SED}&quot; \
551+
<div class="highlight"><pre><span></span><code><span class="ch">#!/bin/sh</span>
552+
<span class="c1">#</span>
553+
<span class="c1"># msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service</span>
554+
<span class="c1">#</span>
555+
<span class="c1"># Replaces ssh-host-config &lt;https://github.com/openssh/openssh-portable/blob/master/contrib/cygwin/ssh-host-config&gt;</span>
556+
<span class="c1"># Adapted from &lt;https://ghc.haskell.org/trac/ghc/wiki/Building/Windows/SSHD&gt; by Sam Hocevar &lt;sam@hocevar.net&gt;</span>
557+
<span class="c1"># Adapted from &lt;https://gist.github.com/samhocevar/00eec26d9e9988d080ac&gt; by David Macek</span>
558+
<span class="c1">#</span>
559+
<span class="c1"># Prerequisites:</span>
560+
<span class="c1"># — a 64-bit installation of MSYS2 itself: https://msys2.org</span>
561+
<span class="c1"># — some packages: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights</span>
562+
<span class="c1">#</span>
563+
<span class="c1"># Gotchas:</span>
564+
<span class="c1"># — the log file will be /var/log/msys2_sshd.log</span>
565+
<span class="c1"># — if you get error “sshd: fatal: seteuid XXX : No such device or address”</span>
566+
<span class="c1"># in the logs, try “passwd -R” (with admin privileges)</span>
567+
<span class="c1"># — if you get error “chown(/dev/pty1, XXX, YYY) failed: Invalid argument”</span>
568+
<span class="c1"># in the logs, make sure your account and group names are detectable (see</span>
569+
<span class="c1"># `id`); issues are often caused by having /etc/{passwd,group} or having</span>
570+
<span class="c1"># a modified /etc/nsswitch.conf</span>
571+
<span class="c1">#</span>
572+
<span class="c1"># Changelog:</span>
573+
<span class="c1"># 16 Apr 2020 — remove additional privileged user</span>
574+
<span class="c1"># — only touch /etc/{passwd,group} if they exist</span>
575+
<span class="c1"># 27 Jun 2019 — rename service to msys2_sshd to avoid conflicts with Windows OpenSSH</span>
576+
<span class="c1"># — use mkgroup.exe as suggested in the comments</span>
577+
<span class="c1"># — fix a problem with CRLF and grep</span>
578+
<span class="c1"># 24 Aug 2015 — run server with -e to redirect logs to /var/log/sshd.log</span>
579+
<span class="c1">#</span>
580+
581+
<span class="nb">set</span> -e
582+
583+
<span class="c1">#</span>
584+
<span class="c1"># Configuration</span>
585+
<span class="c1">#</span>
586+
587+
<span class="nv">PRIV_USER</span><span class="o">=</span>SYSTEM
588+
<span class="nv">UNPRIV_USER</span><span class="o">=</span>sshd <span class="c1"># DO NOT CHANGE; this username is hardcoded in the openssh code</span>
589+
<span class="nv">UNPRIV_NAME</span><span class="o">=</span><span class="s2">&quot;Privilege separation user for sshd&quot;</span>
590+
591+
<span class="nv">EMPTY_DIR</span><span class="o">=</span>/var/empty
592+
593+
594+
<span class="c1">#</span>
595+
<span class="c1"># Check installation sanity</span>
596+
<span class="c1">#</span>
597+
598+
<span class="k">if</span> ! /mingw64/bin/editrights -h &gt;/dev/null<span class="p">;</span> <span class="k">then</span>
599+
<span class="nb">echo</span> <span class="s2">&quot;ERROR: Missing &#39;editrights&#39;. Try: pacman -S mingw-w64-x86_64-editrights.&quot;</span>
600+
<span class="nb">exit</span> <span class="m">1</span>
601+
<span class="k">fi</span>
602+
603+
<span class="k">if</span> ! cygrunsrv -v &gt;/dev/null<span class="p">;</span> <span class="k">then</span>
604+
<span class="nb">echo</span> <span class="s2">&quot;ERROR: Missing &#39;cygrunsrv&#39;. Try: pacman -S cygrunsrv.&quot;</span>
605+
<span class="nb">exit</span> <span class="m">1</span>
606+
<span class="k">fi</span>
607+
608+
<span class="k">if</span> ! ssh-keygen -A<span class="p">;</span> <span class="k">then</span>
609+
<span class="nb">echo</span> <span class="s2">&quot;ERROR: Missing &#39;ssh-keygen&#39;. Try: pacman -S openssh.&quot;</span>
610+
<span class="nb">exit</span> <span class="m">1</span>
611+
<span class="k">fi</span>
612+
613+
614+
<span class="c1">#</span>
615+
<span class="c1"># The unprivileged sshd user (for privilege separation)</span>
616+
<span class="c1">#</span>
617+
618+
<span class="nv">add</span><span class="o">=</span><span class="s2">&quot;</span><span class="k">$(if</span> ! net user <span class="s2">&quot;</span><span class="si">${</span><span class="nv">UNPRIV_USER</span><span class="si">}</span><span class="s2">&quot;</span> &gt;/dev/null<span class="p">;</span> <span class="k">then</span> <span class="nb">echo</span> <span class="s2">&quot;//add&quot;</span><span class="p">;</span> <span class="k">fi)</span><span class="s2">&quot;</span>
619+
<span class="k">if</span> ! net user <span class="s2">&quot;</span><span class="si">${</span><span class="nv">UNPRIV_USER</span><span class="si">}</span><span class="s2">&quot;</span> <span class="si">${</span><span class="nv">add</span><span class="si">}</span> //fullname:<span class="s2">&quot;</span><span class="si">${</span><span class="nv">UNPRIV_NAME</span><span class="si">}</span><span class="s2">&quot;</span> <span class="se">\</span>
620+
//homedir:<span class="s2">&quot;</span><span class="k">$(</span>cygpath -w <span class="si">${</span><span class="nv">EMPTY_DIR</span><span class="si">}</span><span class="k">)</span><span class="s2">&quot;</span> //active:no<span class="p">;</span> <span class="k">then</span>
621+
<span class="nb">echo</span> <span class="s2">&quot;ERROR: Unable to create Windows user </span><span class="si">${</span><span class="nv">PRIV_USER</span><span class="si">}</span><span class="s2">&quot;</span>
622+
<span class="nb">exit</span> <span class="m">1</span>
623+
<span class="k">fi</span>
624+
625+
626+
<span class="c1">#</span>
627+
<span class="c1"># Add or update /etc/passwd entries</span>
628+
<span class="c1">#</span>
629+
630+
<span class="k">if</span> <span class="nb">test</span> -f /etc/passwd<span class="p">;</span> <span class="k">then</span>
631+
sed -i -e <span class="s1">&#39;/^&#39;</span><span class="s2">&quot;</span><span class="si">${</span><span class="nv">UNPRIV_USER</span><span class="si">}</span><span class="s2">&quot;</span><span class="s1">&#39;:/d&#39;</span> /etc/passwd
632+
<span class="nv">SED</span><span class="o">=</span><span class="s1">&#39;/^&#39;</span><span class="s2">&quot;</span><span class="si">${</span><span class="nv">UNPRIV_USER</span><span class="si">}</span><span class="s2">&quot;</span><span class="s1">&#39;:/s?^\(\([^:]*:\)\{5\}\).*?\1&#39;</span><span class="s2">&quot;</span><span class="si">${</span><span class="nv">EMPTY_DIR</span><span class="si">}</span><span class="s2">&quot;</span><span class="s1">&#39;:/bin/false?p&#39;</span>
633+
mkpasswd -l -u <span class="s2">&quot;</span><span class="si">${</span><span class="nv">UNPRIV_USER</span><span class="si">}</span><span class="s2">&quot;</span> <span class="p">|</span> sed -e <span class="s1">&#39;s/^[^:]*+//&#39;</span> <span class="p">|</span> sed -ne <span class="s2">&quot;</span><span class="si">${</span><span class="nv">SED</span><span class="si">}</span><span class="s2">&quot;</span> <span class="se">\</span>
634634
&gt;&gt; /etc/passwd
635635
mkgroup.exe -l &gt; /etc/group
636-
fi
636+
<span class="k">fi</span>
637637

638638

639-
#
640-
# Finally, register service with cygrunsrv and start it
641-
#
639+
<span class="c1">#</span>
640+
<span class="c1"># Finally, register service with cygrunsrv and start it</span>
641+
<span class="c1">#</span>
642642

643-
cygrunsrv -R msys2_sshd || true
644-
cygrunsrv -I msys2_sshd -d &quot;MSYS2 sshd&quot; -p \
645-
/usr/bin/sshd.exe -a &quot;-D -e&quot; -y tcpip -u &quot;${PRIV_USER}&quot; -w &quot;${tmp_pass}&quot;
643+
cygrunsrv -R msys2_sshd <span class="o">||</span> <span class="nb">true</span>
644+
cygrunsrv -I msys2_sshd -d <span class="s2">&quot;MSYS2 sshd&quot;</span> -p <span class="se">\</span>
645+
/usr/bin/sshd.exe -a <span class="s2">&quot;-D -e&quot;</span> -y tcpip -u <span class="s2">&quot;</span><span class="si">${</span><span class="nv">PRIV_USER</span><span class="si">}</span><span class="s2">&quot;</span> -w <span class="s2">&quot;</span><span class="si">${</span><span class="nv">tmp_pass</span><span class="si">}</span><span class="s2">&quot;</span>
646646

647-
# The SSH service should start automatically when Windows is rebooted. You can
648-
# manually restart the service by running `net stop msys2_sshd` + `net start msys2_sshd`
649-
if ! net start msys2_sshd; then
650-
echo &quot;ERROR: Unable to start msys2_sshd service&quot;
651-
exit 1
652-
fi
647+
<span class="c1"># The SSH service should start automatically when Windows is rebooted. You can</span>
648+
<span class="c1"># manually restart the service by running `net stop msys2_sshd` + `net start msys2_sshd`</span>
649+
<span class="k">if</span> ! net start msys2_sshd<span class="p">;</span> <span class="k">then</span>
650+
<span class="nb">echo</span> <span class="s2">&quot;ERROR: Unable to start msys2_sshd service&quot;</span>
651+
<span class="nb">exit</span> <span class="m">1</span>
652+
<span class="k">fi</span>
653653
</code></pre></div>
654654

655655

0 commit comments

Comments
 (0)