Sftp: Difference between revisions
(Created page with "Sometimes crappy old sftp is required. Always prefer scp for copying and web hosting on bitpost.com for sharing. * Ensure you installed openssh-server (of course you did) *...") |
No edit summary |
||
(One intermediate revision by the same user not shown) | |||
Line 3: | Line 3: | ||
* Ensure you installed openssh-server (of course you did) | * Ensure you installed openssh-server (of course you did) | ||
* Set up an ftp group | * Set up an ftp group | ||
sudo addgroup | sudo addgroup ftpgroup | ||
* Edit /etc/ssh/sshd_config | * Edit /etc/ssh/sshd_config | ||
Subsystem sftp internal-sftp | Subsystem sftp internal-sftp | ||
Match group | Match group ftpgroup | ||
ChrootDirectory %h | ChrootDirectory %h | ||
X11Forwarding no | X11Forwarding no | ||
Line 14: | Line 14: | ||
sudo service ssh restart | sudo service ssh restart | ||
* Add user with correct permissions | * Add user with correct permissions | ||
sudo adduser lemmeftp --ingroup | sudo adduser lemmeftp --ingroup ftpgroup --shell /usr/sbin/nologin | ||
# set the password | # set the password | ||
# if the user exists, to change pw: sudo -u lemmeftp passwd | # if the user exists, to change pw: sudo -u lemmeftp passwd | ||
sudo chown root:root /home/lemmeftp | sudo chown root:root /home/lemmeftp | ||
sudo chmod 711 /home/lemmeftp # i needed +x to cd to files | |||
sudo mkdir /home/lemmeftp/files | sudo mkdir /home/lemmeftp/files | ||
sudo chown lemmeftp: | sudo chown lemmeftp:ftpgroup /home/lemmeftp/files | ||
* connect (via nautilus eg)- you MUST specify /files or you will not have permission | |||
sftp://lemmeftp@red/files | |||
# pw as set above | |||
Reference [https://askubuntu.com/questions/420652/how-to-setup-a-restricted-sftp-server-on-ubuntu? 1], and [http://www.krizna.com/ubuntu/setup-ftp-server-on-ubuntu-14-04-vsftpd/ 2] | Reference [https://askubuntu.com/questions/420652/how-to-setup-a-restricted-sftp-server-on-ubuntu? 1], and [http://www.krizna.com/ubuntu/setup-ftp-server-on-ubuntu-14-04-vsftpd/ 2] |
Latest revision as of 14:45, 18 October 2017
Sometimes crappy old sftp is required. Always prefer scp for copying and web hosting on bitpost.com for sharing.
- Ensure you installed openssh-server (of course you did)
- Set up an ftp group
sudo addgroup ftpgroup
- Edit /etc/ssh/sshd_config
Subsystem sftp internal-sftp Match group ftpgroup ChrootDirectory %h X11Forwarding no AllowTcpForwarding no ForceCommand internal-sftp
- Restart sshd service
sudo service ssh restart
- Add user with correct permissions
sudo adduser lemmeftp --ingroup ftpgroup --shell /usr/sbin/nologin # set the password # if the user exists, to change pw: sudo -u lemmeftp passwd sudo chown root:root /home/lemmeftp sudo chmod 711 /home/lemmeftp # i needed +x to cd to files sudo mkdir /home/lemmeftp/files sudo chown lemmeftp:ftpgroup /home/lemmeftp/files
- connect (via nautilus eg)- you MUST specify /files or you will not have permission
sftp://lemmeftp@red/files # pw as set above