Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Title: Setup FTP server in Linux file sharing.
- # ======Setup FTP in Linux======
- # UPDATE and install ftp
- sudo apt update;sudo apt upgrade
- sudo apt install vsftpd
- sudo service vsftpd status
- # Go to the end of the file and add two lines
- sudo nano /etc/vsftpd.conf
- user_sub_token=$USER
- local_root=/home/$USER/ftp
- pasv_min_port=10000
- pasv_max_port=10100
- userlist_enable=NO
- userlist_file=/etc/vsftpd.userlist
- userlist_deny=NO
- allow_anon_ssl=NO
- force_local_data_ssl=NO
- force_local_logins_ssl=NO
- # Configure the firewall
- sudo ufw allow from any to any port 20,21,10000:10100 proto tcp
- # Add user will have access to FTP
- sudo adduser efx
- # Create a folder in home (ftp)
- sudo mkdir /home/efx/ftp
- # Change owner to public
- sudo chown nobody:nogroup /home/efx/ftp
- # Remove the right permission
- sudo chmod a-w /home/efx/ftp
- # Create an upload directory
- sudo mkdir /home/efx/ftp/upload
- # Change owner to non-user
- sudo chown demo:demo /home/efx/ftp/upload/
- # Create a demo file in the upload directory
- echo hi >/home/efx/ftp/upload/saved.txt
- # Add the user to FTP to log in and access the FTP server
- $ echo "demo" |sudo tee -a /etc/vsftpd.userlist
- # Restart the FTP server to apply the changes
- $ sudo systemctl restart vsftpd
- # Create a certificate to secure the FTP connection
- sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem
- # Edit ftp config file once again and change the certificate location to
- sudo nano /etc/vsftpd.conf
- rsa_cert_file=/etc/ssl/private/vsftpd.pem
- rsa_private_key_file=/etc/ssl/private/vsftpd.pem
- ssl_enable=YES
- # Restart server
- sudo systemctl restart vsftpd
- # ======FTP commands to use in Linux======
- # Connect ftp
- ftp 192.168.1.5
- enter user
- enter password
- # Download file (DBs, zip)
- get <filename>
- # Upload file (shell)
- put <filename>
- # Exit
- bye
- # more ftp client commands
- cd - change remote working directory
- lcd - change local working directory
- get - recieve file
- mget - get multiple files
- passive - enter passive transfer mode
- ls - list contents of remote directory
- Telegram Post: https://t.me/efxtv/2723
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement