SSH 配置错误

SSH 配置错误

我的配置有什么问题?我的问题是我无法使用 nas 用户登录 sftp,nas 用户的其他主目录是 /media/nas 我的硬盘安装在 /media/nas 文件夹所有权有问题还是我的配置有问题?我想要 heavyblack 是管理员 nas 仅用于 sftp 访问

heavyblack@raspberrypi:~ $ ls -laF /media/nas/
celkem 36K
drwxr-xr-x 6 root root      4,0K pro 24 00:54 ./
drwxr-xr-x 3 root root      4,0K pro 18 00:20 ../
drwx------ 2 root root       16K lis 30 22:19 lost+found/
drwxrwxr-x 6 nas  sftpusers 4,0K led  5 19:25 moje/
drwxrwxr-x 7 nas  sftpusers 4,0K pro 28 17:55 nas/
drwx------ 2 nas  nas       4,0K pro 24 14:11 .ssh/

我的 sshd_config

#   $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options override the
# default value.

#port
#Port 8956

#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key

# Ciphers and keying
#RekeyLimit default none

# Logging
#SyslogFacility AUTH
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin prohibit-password
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

#PubkeyAuthentication yes

# Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2

#AuthorizedPrincipalsFile none

#AuthorizedKeysCommand none
#AuthorizedKeysCommandUser nobody

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

# To disable tunneled clear text passwords, change to no here!
PasswordAuthentication yes
#PermitEmptyPasswords no

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

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

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes
#GSSAPIStrictAcceptorCheck yes
#GSSAPIKeyExchange no

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

#AllowAgentForwarding yes
#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PermitTTY yes
PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation sandbox
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS no
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none

#bad config
#   PermintRootLogin no

# no default banner path
#Banner none
Banner /etc/issue.net


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

# override default of no subsystems
Subsystem   sftp    /usr/lib/openssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#   X11Forwarding no
#   AllowTcpForwarding no
#   PermitTTY no
#   ForceCommand cvs server

AllowUsers [email protected]
AllowUsers [email protected]
AllowUsers [email protected]
AllowUsers [email protected]
AllowUsers [email protected]

###########################

#DenyUsers pi
AllowUsers [email protected]
#Match User pi
###########################
#Match User heavyblack

Match User nas
    ChrootDirectory /media/nas/
    ForceCommand internal-sftp
    X11Forwarding no
    AllowTcpForwarding no

Match User Tomas
    ChrootDirectory /media/nas/nas/
    ForceCommand internal-sftp
    X11Forwarding no
    AllowTcpForwarding no

Match User ada
    ChrootDirectory /media/nas/nas/
    ForceCommand internal-sftp
    X11Forwarding no
    AllowTcpForwarding no

Match User babicka
    ChrootDirectory /media/nas/nas/
    ForceCommand internal-sftp
    X11Forwarding no
    AllowTcpForwarding no

相关内容