Skip to content
Snippets Groups Projects
Commit 946b21d9 authored by Florent Thiery's avatar Florent Thiery
Browse files

add removal script and rename creation script

parent 3e2ba939
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ def setup(interactive=True): ...@@ -20,7 +20,7 @@ def setup(interactive=True):
'apt-get install --yes pure-ftpd python3-unidecode python3-mediaserver-mediaimport', 'apt-get install --yes pure-ftpd python3-unidecode python3-mediaserver-mediaimport',
dict(line='adduser --disabled-login --gecos "" --shell /bin/false ftp', cond='id ftp', cond_neg=True, cond_skip=True), dict(line='adduser --disabled-login --gecos "" --shell /bin/false ftp', cond='id ftp', cond_neg=True, cond_skip=True),
'mkdir -p /usr/local/bin', 'mkdir -p /usr/local/bin',
'cp "%s/create_ftp_account.sh" /usr/local/bin' % (dir_path), 'cp "%s/mediaimport_*.sh" /usr/local/bin' % (dir_path),
'mkdir -p /home/ftp/storage', 'mkdir -p /home/ftp/storage',
'mkdir -p /home/ftp/storage/incoming', 'mkdir -p /home/ftp/storage/incoming',
'mkdir -p /home/ftp/storage/watchfolder', 'mkdir -p /home/ftp/storage/watchfolder',
......
#!/bin/bash #!/bin/bash
if [ $# -le 1 ] if [ $# -le 1 ]
then then
echo "Usage: create_account.sh username password" echo "Usage: $0 username password"
exit 1 exit 1
fi fi
mkdir -p /home/ftp/storage/incoming/$1 mkdir -p /home/ftp/storage/incoming/$1
mkdir -p /home/ftp/storage/watchfolder/$1 mkdir -p /home/ftp/storage/watchfolder/$1
......
#!/bin/bash
if [ $# -le 0 ]
then
echo "Usage: $0 username"
exit 1
fi
read -p "This will remove all files in /home/ftp/storage/incoming/$1, are you sure? " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
rm -rf /home/ftp/storage/incoming/$1
rm -rf /home/ftp/storage/watchfolder/$1
pure-pw userdel $1
pure-pw mkdb
/etc/init.d/pure-ftpd force-reload
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment