All Projects → johanmeiring → ansible-sftp

johanmeiring / ansible-sftp

Licence: MIT license
SFTP server role for Ansible

Programming Languages

Roff
2310 projects
shell
77523 projects

Projects that are alternatives of or similar to ansible-sftp

fireftp
free, secure, cross-platform FTP/SFTP client for Firefox
Stars: ✭ 137 (+26.85%)
Mutual labels:  sftp
synchly
Automate database backups with customizable recurring schedules.
Stars: ✭ 27 (-75%)
Mutual labels:  sftp
Bash-Backup-Script
A small script to upload backup tar to an external storage service
Stars: ✭ 21 (-80.56%)
Mutual labels:  sftp
core-nodejs
⚡ An FTP/FTPS/SFTP client with modern API.
Stars: ✭ 37 (-65.74%)
Mutual labels:  sftp
Transferetto
Small PowerShell module with FTPS/SFTP functionality
Stars: ✭ 33 (-69.44%)
Mutual labels:  sftp
proftpd-mod proxy
FTP proxy support for ProFTPD
Stars: ✭ 35 (-67.59%)
Mutual labels:  sftp
flutter ssh
SSH and SFTP client for Flutter
Stars: ✭ 105 (-2.78%)
Mutual labels:  sftp
Remote-File-Manager
Server Based GUI File Manager
Stars: ✭ 55 (-49.07%)
Mutual labels:  sftp
ssgo
A SSH-based command line tool for operating remote hosts.
Stars: ✭ 32 (-70.37%)
Mutual labels:  sftp
terraform-aws-sftp
This terraform module is used to create sftp on AWS for S3.
Stars: ✭ 20 (-81.48%)
Mutual labels:  sftp
seedboxsync
Script for sync operations between your NAS and your seedbox.
Stars: ✭ 17 (-84.26%)
Mutual labels:  sftp
sftpserver
SFTP Server (SSH File Transfer Protocol) in Java, based on Apache MINA SSHD
Stars: ✭ 62 (-42.59%)
Mutual labels:  sftp
autoscreen
Automated screen capture utility
Stars: ✭ 76 (-29.63%)
Mutual labels:  sftp
publish-sftp
One-line command to quickly publish resources to a specified server
Stars: ✭ 41 (-62.04%)
Mutual labels:  sftp
grafana-csv-plugin
CSV datasource for Grafana 6.x.x / 7.x.x
Stars: ✭ 33 (-69.44%)
Mutual labels:  sftp
sftp client
An Elixir SFTP Client that wraps Erlang's ssh and ssh_sftp.
Stars: ✭ 29 (-73.15%)
Mutual labels:  sftp
ssh-web-console
Connect to your linux machine via ssh in your browser.
Stars: ✭ 198 (+83.33%)
Mutual labels:  sftp
pluGET
📦 Powerful Package manager which updates plugins & server software for minecraft servers
Stars: ✭ 87 (-19.44%)
Mutual labels:  sftp
raptor
The definitive EasyEngine installer with fully functional backup-restore and SFTP functionalities included
Stars: ✭ 26 (-75.93%)
Mutual labels:  sftp
chromeos-filesystem-sftp
ChromeOS app to access SFTP server
Stars: ✭ 78 (-27.78%)
Mutual labels:  sftp

SFTP-Server

Ansible Role Software License Build Status

An Ansible role which configures an OpenSSH server for chrooted SFTP access. The role is built in such a way that it will not unnecessarily alter a user's OpenSSH customisations. Instead, it simply changes the crucial bits that it needs to, and adds the rest of its configuration in the form of a custom config block (OpenSSH's lack of some form of conf.d/ support forces this behaviour).

Requirements

It is advisable that scp_if_ssh be set to true in the ssh_connection section of your ansible.cfg file, seeing as how Ansible uses SFTP for file transfers by default, and you can easily lock yourself out of your server's SFTP by using this role. The SCP fallback will continue to work. Example config:

; ansible.cfg
...
[ssh_connection]
scp_if_ssh=True

Other than that, only Ansible itself is required. Tested using Ansible 2.0.2.0, 2.2.2.0 and 2.3.0.0. Works on Ubuntu 14.04 and 16.04, untested on other versions. Some work has been done on supporting RHEL, though this is not currently officially supported by the original author (further contributions are obviously welcome ;-)

Role Variables

The following role variables are relevant:

  • sftp_home_partition: The partition where SFTP users' home directories will be located. Defaults to "/home".
  • sftp_group_name: The name of the Unix group to which all SFTP users must belong. Defaults to "sftpusers".
  • sftp_directories: A list of directories that need to be created automatically by default for all SFTP user. Defaults to a blank list (i.e. "[]").
    • Values can be plain strings, or dictionaries containing name and (optionally) mode key/value pairs.
  • sftp_start_directory: A directory that need to be part of sftp_directories values and that is the start directory of new sftp connection. Disable by default with an empty string value.
  • sftp_allow_passwords: Whether or not to allow password authentication for SFTP. Defaults to False.
  • sftp_enable_selinux_support: Whether or not to explicitly enable SELinux support. Defaults to False.
  • sftp_enable_logging: Enable logging. Auth logs will be written to /var/log/sftp/auth.log, and SFTP activity logs will be written to /var/log/sftp/verbose.log. Defaults to False.
  • sftp_users: A list of users, in map form, containing the following elements:
    • name: The Unix name of the user that requires SFTP access.
    • group: An optional user primary group. If set, it will be used for the user's home permission. Otherwise, the sftp_group_name is used.
    • password: A password hash for the user to login with - ie openssl passwd -1 -salt salty passpass. Blank passwords can be set with password: "". NOTE: It appears that UsePAM yes and PermitEmptyPassword yes need to be set in sshd_config in order for blank passwords to work properly. Making those changes currently falls outside the scope of this role and will need to be done externally.
    • shell: Boolean indicating if the user should have a shell access (default to True).
    • authorized: An optional list of files placed in files/ which contain valid public keys for the SFTP user.
    • sftp_directories: A list of directories that need to be individually created for an SFTP user. Defaults to a blank list (i.e. "[]").
    • append: Boolean to add sftp_group_name to the user groups (if any) instead of setting it (default to False).
    • mode: The users home directory mode (defaults to 0750).
    • skeleton: An optional home skeleton directory (e.g: /dev/null). Default to system defaults.
    • home: An optional home directory (e.g: /home/bob). Default to sftp_home_partition/name.
  • sftp_nologin_shell: The "nologin" user shell. (defaults to /sbin/nologin.)

Notes:

  • The sftp_nologin_shell setting defines the shell assigned to sftp_users when the sftp user's shell is set to False. (The nologin shell ensures the user may only use SFTP and have no other login permissions.) This value may vary depending on the operating system version.

Example Playbook

---
- name: test-playbook | Test sftp-server role
  hosts: all
  become: yes
  become_user: root
  vars:
    - sftp_users:
      - name: peter
        password: "$1$salty$li5TXAa2G6oxHTDkqx3Dz/" # passpass
        shell: False
        sftp_directories:
        - directory_only_for_peter1
        - directory_only_for_peter2
      - name: sally
        password: ""
        authorized: [sally.pub]
        home: /var/tmp/sally
        append: True
    - sftp_directories:
      - imports
      - exports
      - { name: public, mode: 755 }
      - other
  roles:
    - sftp-server

License

This Ansible role is distributed under the MIT License. See the LICENSE file for more details.

Donations

Donations are very welcome, and can be made to the following addresses:

  • BTC: 1AWHJcUBha35FnuuWat9urRW2FNc4ftztv
  • ETH: 0xAF1Aac4c40446F4C46e55614F14d9b32d712ECBc
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].