Ferramentas de Usuário

Ferramentas de Site


el:squeeze:config:remote_access:ssh_server

2.3.2 Ssh Server

Εγκατάσταση

root@server:~# aptitude install openssh-server openssh-client

Ρυθμίσεις

Οι ρυθμίσεις για τον SSH server βρίσκονται στο αρχείο /etc/ssh/sshd_config.

Η διεύθυνση δικτύου και η πύλη, όπου ο ssh server δέχεται συνδέσεις μπορούν να ρυθμιστούν. O Server μας θα δέχεται μόνο τις συνδέσεις στην διεύθυνση 192.168.1.100 στην πύλη22 με το πρωτόκολλο SSH έκδοση 2:

/etc/ssh/sshd_config
# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
ListenAddress 192.168.1.100
Protocol 2

#[...]

Για λόγους ασφαλείας, θα απενεργοποιήσουμε τις συνδέσεις στο root . Αυτό θα αποτρέψει τις επιθέσεις ωμής βίας στον κωδικό του root:

/etc/ssh/sshd_config
#[...]

# Authentication:
LoginGraceTime 120
PermitRootLogin no
StrictModes yes

#[...]

Επίσης, δεν θα επιτρέπονται συνδέσεις χωρίς κωδικό:

/etc/ssh/sshd_config
#[...]

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

#[...]

Κάντε επανεκκίνηση της υπηρεσίας:

root@server:~# /etc/init.d/ssh restart

Επαλήθευση

Linux Clients

Τώρα, θα πρέπει να είναι δυνατή μια σύνδεση ssh στον server μας:

Τη πρώτη φορά που θα συνδεθείτε στον απομακρυσμένο server, θα σας προειδοποιήσει ότι η ταυτότητα του host δεν μπορεί να καθοριστεί:

fribeiro@laptop:~$ ssh 192.168.1.100
The authenticity of host '192.168.1.100 (192.168.1.100)' can't be established.
RSA key fingerprint is ee:16:b0:c9:1b:ef:b4:64:e1:86:80:f4:36:9f:08:03.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.100' (RSA) to the list of known hosts.
[email protected]'s password:
Linux server 2.6.32-5-amd64 #1 SMP Fri Oct 15 00:56:30 UTC 2010 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

fribeiro@server:~$ logout
Connection to 192.168.1.100 closed.
fribeiro@laptop:~$

Οι συνδέσεις στον root δεν γίνονται δεκτές:

fribeiro@laptop:~$ ssh -l root 192.168.1.100
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
Permission denied, please try again.
[email protected]'s password:
Permission denied (publickey,password).

Windows Clients

Μια εξαιρετική επιλογή για Ssh client στα windows είναι το PuTTY:

Πώς να γίνετε root

Επειδή η σύνδεση στο root έχει απενεργοποιηθεί, για να γίνετε root σε μία ssh σύνδεση, θα πρέπει να συνδεθείτε σαν απλός χρήστης και μετά να χρησιμοποιήσετε την εντολή su για να αλλάξετε την ταυτότητα σας σε root:

fribeiro@laptop:~$ ssh 192.168.1.100
[email protected]'s password:
Linux server 2.6.32-5-amd64 #1 SMP Fri Oct 15 00:56:30 UTC 2010 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Wed Oct 27 11:01:21 2010 from laptop.home.lan
fribeiro@server:~$ su - root
Password:
root@server:~#

Αναφορές

el/squeeze/config/remote_access/ssh_server.txt · Última modificação em: 2024-02-15 01:05 por 127.0.0.1