Skip to content

aduzsardi/ansible-sftp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SFTP Server setup with ansible playbook and bash script

Install & Configure

  • Create a python virtual environment with ansible installed in it
sudo apt update && sudo apt install python3-pip python3-venv
python3 -m venv ansible
source ansible/bin/active
pip install wheel ansible==2.9.11
  • Add your server in the ansible inventory file hosts

  • Run the sftp-server.yml playbook with ansible

ansible-playbook sftp-server.yml

Notes

sftpuseradd manual

  • This is the script that the will create the sftp users

  • The script is installed in /usr/local/sbin/sftpuseradd

  • It requires root/admin privileges to run

  • The users home directory will be created in /srv/sftp by default, configurable in the ansible playbook or shell script

  • The created users are set to expire after 15 days from their creation , also configurable in the ansible playbook or the actual script

  • The created accounts have read-only permissions

  • View help message of the script

sudo sftpuseradd
# or
sudo sftpuseradd -h
# or
sudo sftpuseradd --help
  • Create an sftp user
sudo sftpuseradd testing1
  • Create an sftp user and send email with credentials to root@localhost by default
sudo sftpuseradd -m testing1

TODO

  • Maybe: HTTP Access to SFTP Home with same username/password
  • Maybe: Store sftp users in config file in git/gitlab and create the users with CI/CD pipeline

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published