• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

SFTP setup help on Ubuntu

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

sup3rcarrx8

Member
Joined
Jun 23, 2003
Location
Folding in California
Hi guys,

I just created a SFTP server on Ubuntu 16.04.1 LTS that will be accessed both internally and externally for file transfers from following the guide found at the Linod link below.
https://www.linode.com/docs/tools-r...g-access-with-sftp-jails-on-debian-and-ubuntu

There are 2 other issues I now need to resolve before I make it 'live' for actual usage.

  1. How do i disable SSH access via putty, terminal, etc. both internally and externally?
  2. Is there a quick way to configure the ports on the system to only allow port 22 for SFTP and block all other ports?
  3. How do I make it so that when you log in with the SFTP account, it starts on a dedicated directory only. I don't want the system folders etc. to be shown.


Thanks in advance!
 

knoober

Member
Joined
Mar 18, 2015
Hi guys,

I just created a SFTP server on Ubuntu 16.04.1 LTS that will be accessed both internally and externally for file transfers from following the guide found at the Linod link below.
https://www.linode.com/docs/tools-r...g-access-with-sftp-jails-on-debian-and-ubuntu

There are 2 other issues I now need to resolve before I make it 'live' for actual usage.

  1. How do i disable SSH access via putty, terminal, etc. both internally and externally?
  2. Is there a quick way to configure the ports on the system to only allow port 22 for SFTP and block all other ports?
  3. How do I make it so that when you log in with the SFTP account, it starts on a dedicated directory only. I don't want the system folders etc. to be shown.


Thanks in advance!

1) I dont understand how you would access the server if you do that? But I also do not know how :)

2) UFW (uncomplicated firewall) is already there and should be able to do that with a couple of quick commands.
Code:
sudo ufw status
#tells you what the default rules are
Code:
sudo ufw deny all
# disables all ports
Code:
sudo ufw allow 22
#allows tcp and udp on port 22
https://help.ubuntu.com/community/UFW
3) beats the hell out of me :)

sorry I could only help with the one question
 
OP
sup3rcarrx8

sup3rcarrx8

Member
Joined
Jun 23, 2003
Location
Folding in California
1) I dont understand how you would access the server if you do that? But I also do not know how :)

2) UFW (uncomplicated firewall) is already there and should be able to do that with a couple of quick commands.
Code:
sudo ufw status
#tells you what the default rules are
Code:
sudo ufw deny all
# disables all ports
Code:
sudo ufw allow 22
#allows tcp and udp on port 22
https://help.ubuntu.com/community/UFW
3) beats the hell out of me :)

sorry I could only help with the one question

Cool at least you've tackled 1 of the 3 questions! :clap:
 

Stratus_ss

Overclockix Snake Charming Senior, Alt OS Content
Joined
Jan 24, 2006
Location
Ontario Canada
Hi guys,

I just created a SFTP server on Ubuntu 16.04.1 LTS that will be accessed both internally and externally for file transfers from following the guide found at the Linod link below.
https://www.linode.com/docs/tools-r...g-access-with-sftp-jails-on-debian-and-ubuntu

There are 2 other issues I now need to resolve before I make it 'live' for actual usage.

  1. How do i disable SSH access via putty, terminal, etc. both internally and externally?
  2. Is there a quick way to configure the ports on the system to only allow port 22 for SFTP and block all other ports?
  3. How do I make it so that when you log in with the SFTP account, it starts on a dedicated directory only. I don't want the system folders etc. to be shown.


Thanks in advance!

So if you wanted to disable ssh access with sftp, its a little complicated mostly because sftp is a part of SSH. In terms of of chrooting users, I am attaching a small pdf walkthrough because I am too lazy to type it out in vbulletin style right now.

View attachment LIN-SFTPandSSHwithSSHD-061016-0635-31.pdf

This was on CentOS but it should give you a rough idea of how to do this on Ubuntu, or at very least what to search for if there are any ubuntu specific things. In this case I am running SFTP in parallel to SSH. The idea is that you redirect port 22 on your internet facing firewall and have it redirect to port 3222. That way people on the internet don't have the option of getting to your SSH server and can only sftp because the SSH daemon is not listening on port 3222

Hope this helps