Sto tentando di configurare un server SSHFTP e, una volta connesso tramite apache @ localhost, vengono immediatamente disconnessi con "Scrittura non riuscita: pipe interrotte" messaggio di errore. Posso connettermi bene con [email protected]
, ma non con l'utente apache
."Write Failed: Broken Pipe" durante il tentativo di accesso tramite ssh con un utente specifico
Queste sono le uniche impostazioni che ho aggiunto al sshd_config (voglio consentire solo apache quando ho capito di lavoro):
Match User apache
ChrootDirectory /apache
AllowTCPForwarding no
X11Forwarding no
ForceCommand /usr/lib/openssh/sftp-server
Match
#AllowUsers apache
E questo è ciò che ho aggiunto al ssh_config:
ServerAliveInterval 120
TCPKeepAlive no
Mi sono assicurato che l'utente apache avesse le autorizzazioni complete sulla cartella/apache, e posso accedere come utente e modificare gli elementi in Terminal. La cartella ha solo 2 file: index.html e test.php
Sono anche andato a un altro computer sulla rete e ho utilizzato FileZilla per accedere come utente jack
. Ha funzionato bene.
Questo è il registro del terminale quando provo a connettermi.
[email protected]:~$ ssh -v [email protected]
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
[email protected]'s password:
debug1: Authentication succeeded (password).
Authenticated to localhost ([127.0.0.1]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
Write failed: Broken pipe
[email protected]:~$
versione di Ubuntu informazioni:
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release: 12.04
Codename: precise
Edit:
ho eseguito il comando sudo grep -ir ssh /var/log/*
e ottenuto questo:
/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
Ho provato a fare chmod 755 /apache
come alcuni siti web hanno suggerito, e cambiando la proprietà, ma sto ancora ricevendo questo errore. La cartella è attualmente di proprietà dell'utente apache
.
Alcuni ulteriori informazioni circa l'utente apache:
[email protected]:/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~
[email protected]:/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
mostraci 'ls -la/apache'' ls -la/apache/.ssh' (entrambi assumendo che '/ apache' sia la directory home per questo utente e la voce'/etc/passwd' per apache. – mnagel
Ho aggiunto i risultati di questi comandi al post originale/apache è la directory home dell'utente apache. –
OK dopo aver giocato con i permessi, ho reso la cartella controllata da root e ho fatto il chmodding a 755. Ora ottengo il errore '/ bin/falso: Nessun file o directory' –