4

I'm having a problem setting up SFTP with an Ubuntu Server 10.04 LTS x64.

I use openSSH with public key authentication, I can login with SSH perfectly with the keys no problem. I can also connect to the FTP server, but I can't write, download or any files from the folder.

Users:

thomas
thomas_filetransfer (home directory is "/" and is part of group "filetransfer")

Groups:

 filetransfer

/etc/ssh/sshd_config:

Not all, just the essentials for SFTP configuration:

Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
LogLevel VERBOSE
PermitRootLogin no
RSAAuthentication yes
PubkeyAuthentication yes

AuthorizedKeysFile /etc/ssh/authorized_keys #might be the problem?

IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication yes
X11Forwarding no
UsePAM no
UseDNS no
AllowUsers thomas thomas_filetransfer

Subsystem sftp internal-sftp

Match group filetransfer
        ChrootDirectory /var/www
        X11Forwarding no
        AllowTcpForwarding no
        ForceCommand internal-sftp

File permissions:

/var/www = owner = root, group = root, permissions = rwxr-x--- (750)
/etc/ssh = owner = root, group = root, permissions = rwxr-xr-x (755)
/etc/ssh/authorized_keys = owner = root, group = root, permissions = -rw-r--r-- (600)

And again, SSH is working perfectly. I set up the private and public keys and they work, SFTP login works also, but when I try to upload/download a file, it get's wrong.

When I authenticate with my ssh box from a remote box I found this in my /var/log/auth.log file, don't know if anything has to do with it anyway:

Connection from 192.168.124.1 port 54993
Failed none for thomas_filetransfer from 192.168.124.1 port 54993 ssh2
Found matching RSA key: b4:a3:3d:18:b9:30:0c:60:e6:2b:31:47:a9:8d:1d:53
Found matching RSA key: b4:a3:3d:18:b9:30:0c:60:e6:2b:31:47:a9:8d:1d:53
Accepted publickey for thomas_filetransfer from 192.168.124.1 port 54993 ssh2
User child is on pid 849

The second line says "failed none for ..."

1 Answer 1

0

I think your ChrootDirectory /var/www which has a ownership of /var/www = owner = root, group = root, permissions = rwxr-x--- (750) is clobbering you. Try chowning the group of /var/www to a group you have membership to and make it 770. See if that works.

Let me know if it helps.

As per OP's chat, he found the answer in this blog site

10
  • Still not working, the owner is now root, and the group is now filetransfer. I can still connect to the SFTP but when I try to create a folder I get "permission denied". I checked the log file and there is nothing special in it, it doesn't give any information when I try to create the folder, although I found this when authenticating with SFTP, dunno if it matters: Failed none for thomas_filetransfer from 192.168.124.1 port 54993 ssh2
    – randomKek
    Mar 13, 2012 at 13:58
  • I forgot to add "sudo chmod 770 /var/www" but now I can't access my SFTP anymore at all.
    – randomKek
    Mar 13, 2012 at 14:04
  • Hmm.... it seems that was my mistake. chmod it back to 750. Let me see what else I can come up with.
    – Carlos
    Mar 13, 2012 at 14:18
  • The only difference I see is that in my setup, I have Subsystem sftp /usr/lib/openssh/sftp-server and ForceCommand /usr/lib/openssh/sftp-server. Also the word "group" has a capital G.
    – Carlos
    Mar 13, 2012 at 14:21
  • I can get back into in it now its back @ 750, do you use public keys or just password auth, and protocol 2? I think the problem is, that it the logged in user is seen as "others" not group, although I am 100% sure the www folder is owned by the group and the user is in the group.
    – randomKek
    Mar 13, 2012 at 14:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .