• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

SSH für FTP Sperren

Rayx

Newbie
Hallo zusammen ich möchte einen Ftp User in sein Verzeichnis einsperren soweit auch noch gut aber wie mach ich das denn wenn er nicht mehr sich als ssh einloggen kann mit Port 22 er soll sich nur noch als ftp mit Port 21 einloggen können

mir wurde gesagt ich soll die sshd_config ändern aber was muss ich da rein schreiben?

danke schon mal im voraus
mfg Rayx
 

K4m1K4tz3

Advanced Hacker
Hättest du gegoogelt, dann wärst du auf folgende Adresse gestoßen: http://man-wiki.net/index.php/5:sshd_config
 
OP
R

Rayx

Newbie
Ich habe gegoogled bin aber dabei nur aus sowas wie chroot gestossen aber das hat mich eig herzlich wenig interessiert was da stand ! da ich nich alles einzelnt machen möchte sondern für alle ftp user!
danke dennoch dafür ich schau mir das mal an!
 
OP
R

Rayx

Newbie
um noch mal auf die seite zurück zu kommen da stehen zwar alle sachen und was ich brauche und so... aber da ich nich stunden suchen möchte eig da mein english nicht das beste ist und ich ´dann alles einzelnd übersetzen müsste kannst du mir nich sagen auf welchen befehl ich achten muss oder??
mfg Rayx
 

K4m1K4tz3

Advanced Hacker
Code:
    AllowUsers
            This keyword can be followed by a list of user name patterns,
            separated by spaces.  If specified, login is allowed only for
            user names that match one of the patterns.  `*' and `?' can be
            used as wildcards in the patterns.  Only user names are valid; a
            numerical user ID is not recognized.  By default, login is
            allowed for all users.  If the pattern takes the form USER@HOST
            then USER and HOST are separately checked, restricting logins to
            particular users from particular hosts.

    AllowGroups
            This keyword can be followed by a list of group name patterns,
            separated by spaces.  If specified, login is allowed only for
            users whose primary group or supplementary group list matches one
            of the patterns.  `*' and `?' can be used as wildcards in the
            patterns.  Only group names are valid; a numerical group ID is
            not recognized.  By default, login is allowed for all groups.

    DenyGroups
            This keyword can be followed by a list of group name patterns,
            separated by spaces.  Login is disallowed for users whose primary
            group or supplementary group list matches one of the patterns.
            `*' and `?' can be used as wildcards in the patterns.  Only group
            names are valid; a numerical group ID is not recognized.  By
            default, login is allowed for all groups.
 
    DenyUsers
            This keyword can be followed by a list of user name patterns,
            separated by spaces.  Login is disallowed for user names that
            match one of the patterns.  `*' and `?' can be used as wildcards
            in the patterns.  Only user names are valid; a numerical user ID
            is not recognized.  By default, login is allowed for all users.
            If the pattern takes the form USER@HOST then USER and HOST are
            separately checked, restricting logins to particular users from
            particular hosts.

Alternativ könntest du natürlich auch keys benutzen und das login per Passwort deaktivieren.
 
OP
R

Rayx

Newbie
Code:
# Package generated configuration file
# See the sshd(8) 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
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

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

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

#Subsystem sftp /usr/lib/openssh/sftp-server

UsePAM yes

AllowUsers root *@ip
So in etwa sieht meine sshd_config aus! ich hab aber ein problem mit der config wenn ich die rauf schmeise dann kann ich mich nich mehr als root einloggen!
voll stumpf
!
 

spoensche

Moderator
Teammitglied
Rayx schrieb:
So in etwa sieht meine sshd_config aus! ich hab aber ein problem mit der config wenn ich die rauf schmeise dann kann ich mich nich mehr als root einloggen!
voll stumpf

Mal abgesehen davon , dass man sich so gut wie niemals als User root einloggt, sondern stattdessen mittels sudo Befehle als Root ausführt, hast du die Publickey Authentifizierung aktiviert und den Passwort Login deaktviert, was zur Folge hat, dass du dich nicht mehr mit einem Passwort anmelden kannst, sondern ein SSH Key benötigts.

Also nicht voll Stumpf;)
 
Oben