- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试设置 SSHFTP 服务器,在通过 apache@localhost 连接后,我立即断开连接,并显示“写入失败:管道损坏”错误消息。我可以很好地连接 jack@localhost
,但不能连接用户 apache
。
这些是我添加到 sshd_config 的唯一设置(我只想在它工作时允许 apache):
Match User apache
ChrootDirectory /apache
AllowTCPForwarding no
X11Forwarding no
ForceCommand /usr/lib/openssh/sftp-server
Match
#AllowUsers apache
这是我添加到 ssh_config 的内容:
ServerAliveInterval 120
TCPKeepAlive no
我确保用户 apache 对/apache 文件夹具有完全权限,并且我可以作为该用户正常登录并修改终端中的项目。该文件夹只有 2 个文件:index.html 和 test.php
我还去了网络上的另一台计算机,并使用 FileZilla 以用户 jack
的身份登录。它工作得很好。
这是我尝试连接时终端的日志。
jack@JacksServer:~$ ssh -v apache@localhost
OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to localhost [127.0.0.1] port 22.
debug1: Connection established.
debug1: identity file /home/jack/.ssh/id_rsa type -1
debug1: identity file /home/jack/.ssh/id_rsa-cert type -1
debug1: identity file /home/jack/.ssh/id_dsa type -1
debug1: identity file /home/jack/.ssh/id_dsa-cert type -1
debug1: identity file /home/jack/.ssh/id_ecdsa type -1
debug1: identity file /home/jack/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA bb:f3:74:9d:97:80:89:dc:d9:68:53:5c:f7:25:19:4e
debug1: Host 'localhost' is known and matches the ECDSA host key.
debug1: Found key in /home/jack/.ssh/known_hosts:1
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/jack/.ssh/id_rsa
debug1: Trying private key: /home/jack/.ssh/id_dsa
debug1: Trying private key: /home/jack/.ssh/id_ecdsa
debug1: Next authentication method: password
apache@localhost's password:
debug1: Authentication succeeded (password).
Authenticated to localhost ([127.0.0.1]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
Write failed: Broken pipe
jack@JacksServer:~$
Ubuntu 版本信息:
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release: 12.04
Codename: precise
编辑:
我运行了命令 sudo grep -ir ssh/var/log/*
并得到了这个:
/var/log/auth.log~:Aug 13 16:08:15 JacksServer sshd[32292]: fatal: bad ownership or modes for chroot directory "/apache"
/var/log/auth.log~:Aug 13 16:08:15 JacksServer sshd[32156]: pam_unix(sshd:session): session closed for user apache
我尝试按照某些网站的建议执行 chmod 755/apache
并更改所有权,但我仍然收到此错误。该文件夹当前归用户 apache
所有。
有关 apache 用户的更多信息:
root@JacksServer:/apache# ls -la /apache
total 24
drwxr-xr-x 4 apache root 4096 Aug 13 15:49 .
drwxr-xr-x 29 root root 4096 Aug 13 03:06 ..
drwxr-xr-x 2 apache nogroup 4096 Aug 13 13:57 .cache
-rw-r--r-- 1 apache root 5 Aug 13 03:56 index.html
-rw-r--r-- 1 apache root 0 Aug 13 03:56 index.html~
drwxr-xr-x 8 apache root 4096 Aug 13 15:51 .ssh
-rw-r--r-- 1 apache root 20 Aug 13 03:59 test.php
-rw-r--r-- 1 apache root 0 Aug 13 03:59 test.php~
root@JacksServer:/apache# ls -la /apache/.ssh
total 92
drwxr-xr-x 8 apache root 4096 Aug 13 15:51 .
drwxr-xr-x 4 apache root 4096 Aug 13 15:49 ..
-rw-r--r-- 1 apache jack 220 Jun 6 20:08 .bash_logout
drwxr-xr-x 19 apache jack 4096 Aug 13 15:04 .cache
drwxr-xr-x 3 apache jack 4096 Jun 6 20:49 .compiz-1
drwxr-xr-x 3 apache jack 4096 Jun 6 20:22 .dbus
drwxr-xr-x 5 apache jack 4096 Aug 13 05:37 .gconf
-rw-r----- 1 apache jack 0 Aug 13 15:47 .gksu.lock
drwxr-xr-x 3 apache jack 4096 Jun 6 20:22 .local
-rw-r--r-- 1 apache jack 675 Jun 6 20:08 .profile
-rw------- 1 apache jack 256 Jun 6 20:22 .pulse-cookie
drwxr-xr-x 2 apache jack 4096 Aug 13 14:20 .ssh
-rw------- 1 apache jack 56 Aug 13 04:45 .Xauthority
-rw------- 1 apache jack 44215 Aug 13 13:54 .xsession-errors
最佳答案
这两个问题的答案都在这个线程中:https://askubuntu.com/questions/134425/how-can-i-chroot-sftp-only-ssh-users-into-their-homes
“基本上 chroot 目录必须由 root 拥有,不能是任何组写访问权限。”
这意味着您需要确保您的 ChrootDirectory
(/apache
) 由 root 所有,并且不能被任何组/其他人写入。这是由于一些模糊的 setuid 相关安全风险 outlined here .
此外,要回答关于 /bin/false: No such file or directory
的问题:尝试使用 /sbin/nologin
代替。
关于ubuntu - "Write Failed: Broken Pipe"尝试通过特定用户通过 ssh 登录时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18220104/
我正在尝试为我的用户提供使用 Google 或 Facebook 登录的选项。到目前为止,我找到了一个实现 Google 登录流程的示例,但如果我可以在同一 Activity 中实现类似的 Faceb
我有一个网页,它对用户是否登录很敏感。我使用的是 Google 登录 Javascript SDK。当用户到达此页面时,我想显示一个插页式广告(“正在加载...”),然后 1)如果用户已登录则呈现页面
我用 digitalocean 创建了一个 droplet,并使用 apt install mariadb-server 命令安装了 mariadb。现在我想使用 php 连接到我的服务器,我使用这个
这个问题在这里已经有了答案: Inno Setup - Signing fails with "Sign Tool failed with exit code 0x1" (2 个回答) 3年前关闭。
我正在尝试使用他们的新 API 实现 google 登录:https://developers.google.com/identity/sign-in/web/ 登录和注销工作正常。我的问题是我不知道
我的应用程序具有谷歌登录、Facebook 登录和 braintree 集成。 我已将以下代码放入 appdelegate.swift 中: func application(_ applicatio
我有一个 Flask 应用程序,最近在我的登录/退出表单中实现了 Flask-Login: @account.route('/sign-in', methods=['POST', 'GET']) de
friend 们,我是初学者级别的 ios swift 学习者。我一直在尝试在我的试用应用程序中进行谷歌登录。根据来自谷歌开发人员和其他教程的资源,我成功地使用 UIView 进行了登录。然后我试图在
我正在使用 Ionic 在 Codeigniter/Ion_Auth/codeigniter-restclient 之上构建登录系统,当我尝试从“ionic 服务器”登录时,登录可以正常工作,但对 L
在 Docker 文件中我有这个 FROM ubuntu RUN apt update && apt -y upgrade RUN apt install -y sudo # Setup ops us
对于 Java 开发,我使用 Slf4j 和 Logback。 Logger logger = LoggerFactory.getLogger(HelloWorld.class); logger.de
在 Scala 应用程序中进行日志记录的好方法是什么?与语言哲学一致的东西,不会使代码困惑,并且维护成本低且不引人注目。以下是基本要求列表: 简单 不会使代码困惑。 Scala 以其简洁而著称。我不希
我正在尝试将我的登录名转换为 Retrofit2 我的旧 LoginActivity: public class LoginActivity extends Activity { private st
我正在尝试让 google+ 登录在 android 上运行。我的问题是,每当我使用 eclipse 运行它时,google 开发站点上提供的示例都能完美运行。当我签署 apk 并在我的设备上手动安装
这个问题已经有答案了: JS Simple but Safe Login? [closed] (1 个回答) 已关闭 6 年前。 我正在尝试使用 JavaScript 创建登录页面。它实际上只是一个带
其他章节请看: react 高效高质量搭建后台系统 系列 登录 本篇将完成 登录模块 。效果和 spug 相同: 需求 如下:
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 1 年前。
我在使用 ReactJs 中的 facebook-login 组件时遇到问题,代码与文档中的完全一样,但仍然无法正常工作。你能帮我找出我做错了什么吗? import React, { Componen
我有一个项目,其中包含许多具有自己的日志记录的“工具”类。这些日志文件是在应用程序启动时创建的,但在使用之前一直为空。 是否可以告诉logback在启动时不应该创建空文件?但是仅在使用它们时? 不知何
我正在创建一个需要用户授权才能访问某些功能的网站。我目前正在研究用户如何创建帐户以及如何利用 session 来授权他们的登录。用户信息存储在名为 user 的 MySQL 表中,其中可能包括用户名和
我是一名优秀的程序员,十分优秀!