Advertisement
efxtv

How to set up and configure an FTP server in Linux

Dec 30th, 2023
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. How to set up and configure an FTP server in Linux?
  2. ***********************************************************
  3. Telegram post: https://t.me/efxtv/3257
  4. Telegram channel: https://t.me/efxtv
  5. ***********************************************************
  6.  
  7. FTP (file transfer protocol) is an internet protocol that is used for transferring files between client and server over the internet or a computer network. It is similar to other internet protocols like SMTP which is used for emails and HTTP which is used for websites.
  8.  
  9. Step 1: Install FTP server
  10. $ sudo apt install vsftpd
  11.  
  12. Step 2: Start the FTP server
  13. $ sudo systemctl enable vsftpd
  14. $ sudo service start vsftpd
  15. $ sudo systemctl enable --now vsftpd
  16.  
  17. Step 2: Configure Firewall
  18. $ sudo ufw allow 20/tcp
  19. $ sudo ufw allow 21/tcp
  20. $ sudo ufw allow 990/tcp
  21. $ sudo ufw allow 5000:10000/tcp
  22.  
  23. Step 3: Create ftpuser
  24. $ sudo adduser ftpuser
  25.  
  26. Step 4: Configure user
  27. $ sudo nano /etc/ssh/sshd_config
  28. ...
  29. DenyUsers ftpuser
  30. ...
  31.  
  32. Step 5: Restart sshd
  33. $ sudo systemctl restart sshd
  34. $ sudo mkdir /ftp
  35. $ sudo chown adminuser /ftp
  36.  
  37. Step 6: Edit config file
  38. $ sudo nano /etc/vsftpd.conf
  39. ...
  40. anonymous_enable=NO
  41. local_enable=YES
  42. write_enable=YES
  43. pasv_min_port=5000
  44. pasv_max_port=10000
  45. local_root=/ftp
  46. chroot_local_user=YES
  47. chroot_list_enable=YES
  48. chroot_list_file=/etc/vsftpd.chroot_list
  49. allow_writeable_chroot=YES
  50. local_umask=0002
  51. ...
  52. Step 7: Now, we need to create that list file
  53. $ sudo touch /etc/vsftpd.chroot_list
  54. $ sudo nano /etc/vsftpd.chroot_list
  55.  
  56. Step 8: Restart our vsftpd server
  57. $ sudo systemctl restart --now vsftpd
  58. $ sudo systemctl restart --now vsftpd
  59.  
  60. Most used FTP server commands
  61. πŸ”΄ connect $ ftp -p 21 192.168.***
  62. πŸ”΄ get filename- download the specified file
  63. πŸ”΄ put filename- uploads the specified file
  64. πŸ”΄ pwd- print the current working directory
  65. πŸ”΄ cwd- change working directory
  66. πŸ”΄ dele- delete the specified file
  67. πŸ”΄ cdup- change to the parent directory
  68. πŸ”΄ help- displays help information
  69. πŸ”΄ cd- change the working directory
  70. πŸ”΄ bye- end FTP session
  71.  
  72. ┏━━━━━━━━━━━━━━━━━━┓  
  73. πŸ”Ί t.me/efxtv πŸ”Ί
  74. ┗━━━━━━━━━━━━━━━━━━┛
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement