Link folders to SFTP root

Who to bind a folder in the home diretocry for SFTP users.

Create folder in SFTP user home directory

mkdir /home/sftp-root/<folder>

Edit /etc/fstab and add the line below:

sudo nano /etc/fstab
 /data/<folder>        /home/sftp-root/<folder>        auto    ro,bind        0       0

 


Setup SSH for SFTP usage

I used this guide to setup users and home directory for my sftp users but changed some steps. Done this on Ubuntu server 11.10 64-bit.

http://solderintheveins.co.uk/2011/03/ubuntu-sftp-only-account-how-to/

Make a new group

sudo addgroup sftponly

Creating the User Account:

sudo useradd -d /home/sftp-root -s /usr/lib/sftp-server -M -N -g sftponly <username>

Setting the Password:

sudo passwd <username> 

Make a home directory for all sftp users

sudo mkdir /home/sftp-root 
sudo chown root:sftponly /home/sftp-root 
sudo chmod 770 /home/sftp-root

Add an entry to /etc/shells:

/usr/lib/sftp-server

Edit the SSH config /etc/ssh/sshd_config:

Change the line Subsystem sftp /usr/lib/openssh/sftp-server to this:

Subsystem sftp internal-sftp

Now add the following 5 lines at the bottom of the file:

Match group sftponly
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

Restart ssh

sudo /etc/init.d/ssh restart 

And now your done! :)
I hope this helped you.


Install Transmission 2.42 on Ubuntu 11.10

Download Common and Daemon from link below:
https://launchpad.net/~transmissionbt/+archive/ppa/+sourcepub/2037201/+listing-archive-extra

Upload to your Home Diretory and type in this to install Transmission Common:
sudo pdkg -i transmission-common_2.42-0ubuntu0.11.10.1_all.deb

when finished install Transmission Daemon:
sudo pdkg -i transmission-daemon_2.42-0ubuntu0.11.10.1_amd64.deb