Bearbeiten von „OpenSsh“
Zur Navigation springen
Zur Suche springen
Warnung: Du bist nicht angemeldet. Deine IP-Adresse wird bei Bearbeitungen öffentlich sichtbar. Melde dich an oder erstelle ein Benutzerkonto, damit Bearbeitungen deinem Benutzernamen zugeordnet werden.
Die Bearbeitung kann rückgängig gemacht werden. Bitte prüfe den Vergleich unten, um sicherzustellen, dass du dies tun möchtest, und veröffentliche dann unten deine Änderungen, um die Bearbeitung rückgängig zu machen.
Aktuelle Version | Dein Text | ||
Zeile 14: | Zeile 14: | ||
<pre>chmod 755 .ssh | <pre>chmod 755 .ssh | ||
chmod 600 .ssh/authorized_keys | chmod 600 .ssh/authorized_keys | ||
</pre> | </pre> | ||
= Kommandos = | = Kommandos = | ||
< | <pre>ssh -i /home/jonny/id_rsa jonny@extern.host.de | ||
ssh -i /home/jonny/id_rsa jonny@extern.host.de | |||
rsync -e "ssh -i /home/jonny/id_rsa" /home backup@backup.example.com | rsync -e "ssh -i /home/jonny/id_rsa" /home backup@backup.example.com | ||
ssh-copy-id | ssh-copy-id -i ~/.ssh/id_rsa hm@host | ||
</pre> | </pre> | ||
== Port-Forwarding == | == Port-Forwarding == | ||
Auf dem Server in /etc/ssh/sshd_config: | Auf dem Server in /etc/ssh/sshd_config: | ||
< | <pre># allow remote port forwarding: | ||
# allow remote port forwarding: | |||
GatewayPorts yes | GatewayPorts yes | ||
</pre> | </pre> | ||
Zeile 89: | Zeile 33: | ||
Lokal: | Lokal: | ||
< | <pre>ssh -nNT -p 10106 -R 6379:localhost:6379 wk@bt | ||
ssh -nNT -p 10106 -R 6379:localhost:6379 wk@bt | </pre> | ||
</ | |||
== SFTP-chroot-Umgebung == | == SFTP-chroot-Umgebung == | ||
* /etc/ssh/sshd_config | * /etc/ssh/sshd_config | ||
<pre> | <pre>Match Group sftponly | ||
Match Group sftponly | |||
ChrootDirectory /home/%u | ChrootDirectory /home/%u | ||
ForceCommand internal-sftp | ForceCommand internal-sftp | ||
Zeile 103: | Zeile 45: | ||
</pre> | </pre> | ||
oder | oder | ||
<pre> | <pre>Match User jonny | ||
Match User jonny | |||
ChrootDirectory /opt/jail_jonny | ChrootDirectory /opt/jail_jonny | ||
ForceCommand internal-sftp | ForceCommand internal-sftp | ||
Zeile 110: | Zeile 51: | ||
</pre> | </pre> | ||
* Rechte /opt/jail_jonny: | * Rechte /opt/jail_jonny: | ||
< | <pre>DIR=/opt/jail_jonny | ||
DIR=/opt/jail_jonny | |||
chown root.root $DIR | chown root.root $DIR | ||
chmod 755 $DIR | chmod 755 $DIR | ||
</ | </pre> | ||
* Eintrag in /etc/fstab: | * Eintrag in /etc/fstab: | ||
<pre> | <pre> | ||
Zeile 129: | Zeile 68: | ||
* Server: | * Server: | ||
** User einrichten: adduser buptiger | ** User einrichten: adduser buptiger | ||
** In /home/buptiger/.ssh/authorized_keys: | ** In /home/buptiger/.ssh/authorized_keys: | ||
<pre> | <pre> | ||
command="/usr/local/bin/rrsync /opt/extbackup/caribou",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AAA...5Ow== extbup@caribou | command="/usr/local/bin/rrsync /opt/extbackup/caribou",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AAA...5Ow== extbup@caribou | ||
</pre> | </pre> | ||
oder mit Nur-Lese-Zugriff | oder mit Nur-Lese-Zugriff: | ||
<pre> | <pre> | ||
command="/usr/local/bin/rrsync -ro /opt/extbackup/caribou",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AAA...5Ow== extbup@caribou | command="/usr/local/bin/rrsync -ro /opt/extbackup/caribou",no-agent-forwarding,no-port-forwarding,no-pty,no-user-rc,no-X11-forwarding ssh-rsa AAA...5Ow== extbup@caribou | ||
</pre> | </pre> | ||
< | <pre> | ||
FN=/usr/local/bin/rrsync | FN=/usr/local/bin/rrsync | ||
test -x $FN | test -x $FN && gunzip /usr/share/doc/rsync/scripts/rrsync.gz -c > $FN && chmod uog+x $FN | ||
</ | </pre> | ||
* Client: | * Client: | ||
** Die Zielpfadangabe von rsync ist immer relativ zu dem im Server angegebenen Verzeichnis /opt/extbackup/caribou | ** Die Zielpfadangabe von rsync ist immer relativ zu dem im Server angegebenen Verzeichnis /opt/extbackup/caribou | ||
** rsync -a /opt/backup/dayly buptiger@server:. | ** rsync -a /opt/backup/dayly buptiger@server:. | ||
== Chroot für rsync: == | == Chroot für rsync: == | ||
* /usr/local/bin/MkChroot.pl: | * /usr/local/bin/MkChroot.pl: | ||
< | <pre>SCRIPT=/usr/local/bin/MkChroot.pl | ||
SCRIPT=/usr/local/bin/MkChroot.pl | |||
cat <<'EOS' >$SCRIPT | cat <<'EOS' >$SCRIPT | ||
#! /usr/bin/perl | #! /usr/bin/perl | ||
Zeile 208: | Zeile 138: | ||
EOS | EOS | ||
chmod uog+x $SCRIPT | chmod uog+x $SCRIPT | ||
</ | </pre> | ||
* Erstellen der chroot-Umgebung: | * Erstellen der chroot-Umgebung: | ||
< | <pre>MkChroot.pl /bin/bash | ||
MkChroot.pl /bin/bash | |||
MkChroot.pl rsync | MkChroot.pl rsync | ||
cd /opt/jail | cd /opt/jail | ||
unzip /tmp/chroot.zip | unzip /tmp/chroot.zip | ||
</ | </pre> | ||
* Mount als /etc/fstab-Eintrag: | * Mount als /etc/fstab-Eintrag: | ||
<pre>/opt/www /opt/jail/www none bind 1 0 | <pre>/opt/www /opt/jail/www none bind 1 0 |