This project implements a simple FTP server using socket programming in Python. The client can connect to the server, authenticate with a username and password, and perform basic file operations such as listing files, uploading files, and deleting files on the server.
- Authentication: The client must authenticate with a username and password before performing any operations.
- File Operations:
- LIST: List all files on the server.
- UPLOAD
<path>: Upload a file to the server. - DELETE
<filename>: Delete a file from the server. - LOGOUT: Disconnect from the server.
- HELP: Display a list of available commands.
- Python 3.x
- Tkinter library for GUI (for the client).
- Client and server must be connected to a common network.
- Clone the repository to your server machine.
- Ensure that the
server_datadirectory exists in the same directory asserver.py. You can modify theSERVER_DATA_PATHvariable inserver.pyto specify a custom location for storing server files. - Run the
server.pyfile to start the server.
- Clone the repository to your client machine.
- Edit the
client.pyfile and replace theIPvariable with the actual IP address of the server. - Ensure that the
client_datadirectory exists in the same directory asclient.py. This directory should contain files you want to upload to the server. - Run the
client.pyfile to connect to the server.
- When you run the client, a login window will appear. Enter your username and password to authenticate.
-
The following usernames and passwords are hardcoded into the server for authentication:
alice: password123bob: securepasscharlie: letmeindave: secretwordeve: 123456frank: qwertygrace: ilovepythonharry: mypasswordirene: p@ssw0rdjason: pythonrocks
You can modify the list of usernames and passwords in the server.py file.
After authentication, you can use the following commands:
- LIST: Lists all files on the server.
- UPLOAD
<path>: Uploads a file from the specified path on the client to the server. - DELETE
<filename>: Deletes a file from the server. - LOGOUT: Disconnects from the server.
- HELP: Displays a list of available commands.
[STARTING] Server is starting.
[LISTENING] Server is listening on 192.168.29.147:4469.
[NEW CONNECTION] ('192.168.29.147', 50194) connected.
[ACTIVE CONNECTIONS] 1
[DISCONNECTED] ('192.168.29.147', 50194) disconnectedWelcome to the File Server Login Page.
Authentication successful.
Welcome to the File Server.
> HELP
LIST: List all the files from the server.
UPLOAD <path>: Upload a file to the server.
DELETE <filename>: Delete a file from the server.
LOGOUT: Disconnect from the server.
HELP: List all the commands.
> LIST
123.txt
ex.txt
> UPLOAD client_data/abc.txt
File uploaded successfully.
> LIST
123.txt
abc.txt
ex.txt
> DELETE abc.txt
File deleted successfully.
> LIST
123.txt
ex.txt
> LOGOUT
Disconnected from the server.- Ensure that both the client and server are on the same network.
- Replace the placeholder IP address in the
client.pyfile with the actual IP address of the server. - The server must be running before the client can connect.
- File Paths: The
client_datadirectory on the client machine should contain the files you want to upload to the server.
This project is licensed under the MIT License.
For any feedback or support regarding this project, please open an issue on GitHub.
Thank you for exploring the FTP Server Using Socket Programming in Python! 💻