Giter Site home page Giter Site logo

addftp-user's Introduction

ADD FTP USER

This script can be executed inside a linux-server to create an ftp-user.

It will basically:

  1. creates an user on linux-server.
  2. Adds the user to allowed user's list.
  3. Creates the credentials.
  4. Allows login via FileZilla.

The code:

# file: NewFTPUser.bashrc

function addFTPUser () {
  echo "Adding user $1 as ftp to <ServerName>"
	command sudo adduser $1
	command sudo mkdir /home/$1/ftp
	command sudo chown nobody:nogroup /home/$1/ftp
	command sudo mkdir /home/$1/ftp/files
	command sudo chown $1:$1 /home/$1/ftp/files
	
	# Checks Permission
	command ls -la /home/$1/ftp
	
	# Creates a text file for testing.
	command echo "vsftpd test file" | sudo tee /home/$1/ftp/files/testfile.txt
	command echo $1 | sudo tee -a /etc/vsftpd.user_list
	
	# Check Allowed Users
	command cat /etc/vsftpd.user_list
	command sudo systemctl restart vsftpd
	
	# Ended
	command echo "user $1 created successfully!"
}

For acessing this FTP server you will need to have your linux-server configured.

If you are on windows, would be recommended to create a permanent route to the ftp-server.

Creating a permanent route from a pc to the server:

In your Windows, open the command line as administrator and type this:

route -P ADD <server-ip> MASK 255.255.255.255 192.168.X.1

Then, go to your Filezilla, insert credentials and login.

Hope that it helps!

Happy coding!

addftp-user's People

Contributors

ngeorgj avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.