14

I started from the following article to set up SFTP on Ubuntu Server: http://blog.srmklive.com/2013/04/24/how-to-setup-sftp-server-ftp-over-ssh-in-ubuntu/. If I follow these instructions, I can connect with SFTP, but I am no longer able to connect to SSH from a terminal:

This service allows sftp connections only.
Connection to 10.0.0.130 closed.

Here are the changes I made to sshd_config:

Subsystem sftp internal-sftp -f AUTH -1 VERBOSE

AllowGroups sftpusers sftp sshusers

Match Group sftpusers
ChrootDirectory %h
AllowTCPForwarding yes
ForceCommand internal-sftp

X11Forwarding no

The user in question, jcoulson, is in both sftpusers and sshusers groups.

Any hints? Any further info you need? Thanks!

4 Answers 4

19

This setting

Match Group sftpusers
...
ForceCommand internal-sftp

restricts access to sftp for the users in the group sftpusers. Either remove your user from the sftpusers group or remove that forcecommand option.

1
  • 5
    +1. This should be the accepted answer.
    – dr_
    Jul 5, 2019 at 8:54
16

You don't need to make any changes to the default installation of ssh to be able to use both sftp and ssh. All sftp is, is a means of doing file transfer over ssh.

2
  • 1
    Yep. I just discovered that myself. Hours of frustration wasted! Now, watch out for my next question on this site: How do I restrict an SFTP user to his home directory only? Thanks!
    – mrcoulson
    Jan 8, 2014 at 17:51
  • @mrcoulson the ChrootDirectory directive should do that. Did you resolve this issue? Feb 28, 2014 at 16:19
0

i've used a similar method with the same error and found out to use sshfs to connect/mount the sftp share on the server. Filezilla also connects but not able to get in with the terminal ssh command. http://www.fullybaked.co.uk/articles/chroot-ssh-ftp-users-to-home-directory was the tutorial i used to make it. I also had to create the home directory manually as the useradd command is not recommanded under ubuntu.

sshfs user@server:/folder /home/user/folder-to-mount-in/ -p 22

and to unmount

fusermount -u /home/user/folder-to-mount-in/

that procedure with an automated script, rsa key authentication, cron and rsync helped me to plan automated backup.

0

I solved a very a similar problem by considering it is exclusive : either you want to ssh or you want to sftp. Hence, removing my main user from the sftp group and leaving only my guests users as members of this sftp group, made ssh back again for my main user.

You must log in to answer this question.

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