Register
It is currently Wed Dec 13, 2017 12:50 pm

users to submit email for ftp creation


All times are UTC - 6 hours


Post new topic Reply to topic  [ 5 posts ] 
Author Message
 PostPosted: Thu Jul 13, 2017 9:16 am   

Joined: Tue Apr 12, 2016 4:11 am
Posts: 51
hi all,

created a bash script to create an ftp account, its here -

Code:
#!/bin/bash

dir=/mnt/sftp
group=sftp_users

    echo "Enter UserName:"
    read user

    if id $user ; then
        echo "$user already exists as you can see above, please re-run the script"
        exit
        else
        echo "$user not in system, ok to continue"
    fi

    echo "Enter Password:"
    read passwd
    echo "$user:$passwd" >> /ftp_details/accounts.csv
    echo "is this a normal user (press 1) or vfx user (press 2) ?"
    read choice
   
    case $choice in
        1)
            useradd -g $group -d /upload -s /sbin/nologin $user
            mkdir -p $dir/$user/upload
            chown $user:$group $dir/$user/upload
            touch $dir/$user/upload/WARNING_everything_in_here_will_get_removed_in_14_days_time.txt
            ;;
        2)
            useradd $user -s /sbin/nologin -b /mnt/vfx/
            ;;
        *)
            echo "invalid selection, please re-run the script"
            exit
            ;;
    esac

    echo $user:$passwd | chpasswd


it works great but now i want to do something else which i dont know if possible but i will try and explain

i want the end user/customer/client or whoever submits an ftp user creation for us to send an email to sftp.molinare.co.uk and when they email it, the sftp server i created with the script will pick up what username and password they want to make the ftp account and it will create it and then send them an email saying the ftp account has been created with the username/password they gave

obviously i will configure postfix SMTP on the sftp server so it can do this

cheers,

rob


Top
 Profile  
 PostPosted: Fri Jul 14, 2017 9:13 am   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 560
hundreds of thousand ways to do this.

What is your IMAP/POP server?

And how many domains does this MTA serve?
Which of these a virtual?


Top
 Profile  
 PostPosted: Fri Jul 14, 2017 12:39 pm   

Joined: Tue Apr 12, 2016 4:11 am
Posts: 51
ok scrap this idea, thought of another better way


im going to create a html form for this on my sftp server, so install apache on it aswell


its going to look like this -


username: text box where user types in username


password: text box where user types in password


submit button: grabs users inputs from text box's and puts it in the script and runs script


once clicked on the submit button goes to the next page and gives them this -


ftp account created with details


username: what they typed


password: what they typed


im going to have to do research into html coding so a quick google and youtube videos


what you think?


rob


Top
 Profile  
 PostPosted: Sat Jul 15, 2017 12:28 am   

Joined: Mon Oct 20, 2014 9:53 am
Posts: 560
a minor job which can be done by each and every web framework.
Again hunderts of thousands ways to get this done.

Can even be done with a simple web server implemented with bash.
But not advisable at all.
Use something like web2py or alike.

Writing a simple formular and acting on submit is day by day web dev work.
Implementing this in a secure manner takes much more time.
Frameworks are designed to deliver this.


Top
 Profile  
 PostPosted: Mon Jul 17, 2017 1:23 pm   

Joined: Tue Apr 12, 2016 4:11 am
Posts: 51
going to end this thread and start a new one as im not going to do it this way no more


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP