From ea432f6616110075e920800c32819a62743b30b3 Mon Sep 17 00:00:00 2001 From: RafayAhmad7548 Date: Thu, 10 Jul 2025 18:34:37 +0500 Subject: [PATCH 1/6] mit license --- LICENSE.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..4a15f19 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,9 @@ +MIT License + +Copyright © 2025 RafayAhmad + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From d7c9e261c38d27227c0789217ca41fd6d29a4fec Mon Sep 17 00:00:00 2001 From: RafayAhmad7548 Date: Thu, 10 Jul 2025 18:35:13 +0500 Subject: [PATCH 2/6] licnese again --- LICENSE.md => LICENSE | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename LICENSE.md => LICENSE (100%) diff --git a/LICENSE.md b/LICENSE similarity index 100% rename from LICENSE.md rename to LICENSE From 9ec4eab173ae991fb71bc790c1be6ab9d94ca377 Mon Sep 17 00:00:00 2001 From: RafayAhmad7548 Date: Thu, 10 Jul 2025 18:39:35 +0500 Subject: [PATCH 3/6] license work pls --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 4a15f19..68dc999 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright © 2025 RafayAhmad +Copyright (c) 2025 RafayAhmad Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: From 1705ae08cc3410a6bdc8c52745ec290090f88bab Mon Sep 17 00:00:00 2001 From: RafayAhmad7548 Date: Thu, 10 Jul 2025 20:11:23 +0500 Subject: [PATCH 4/6] hotfix for user setup guide --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 624cd8c..c356e8c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ SQLite, PostgreSQL and MYSQL are supported for the database, Authentication can # Installation Start by downloading the tarball from the latest release from the [releases](https://forgejo.fluxgrid.pk/RafayAhmad/flux-sftp/releases), then extract the tarball as follows ```bash -tar -xzvf flux-sftp.tar.gz -C / +sudo tar -xzvf flux-sftp.tar.gz -C / ``` ## Database before you can run the server you need to setup a database, SQLite, PostgreSQL and MYSQL are supported. get a database server running or simply create a sqlite database file and configure the server as mentioned in the [configuration section](#configuration). @@ -16,6 +16,18 @@ the database table should have a username field, and optionally public key and p ***Note that registering users must be done manually by inserting records into the database as of now.*** +## User setup +create a user named fluxsftp as follows +```bash +sudo useradd -r -s /usr/sbin/nologin fluxsftp +``` +this user needs to own the jail directory, make sure to change ownership of the jail directory you have specified in the config +```bash +sudo chown -R fluxsftp:fluxsftp /srv/sftp +``` + +***When u register a new user make sure to create a directory for them in the jail directory and make sure it is owned by the fluxsftp user*** + ## Enable and Start after you have configured the database you can start the server as follows ```bash From 5348221b458eda2380ff729b046e36b34b737a38 Mon Sep 17 00:00:00 2001 From: RafayAhmad7548 Date: Thu, 10 Jul 2025 20:14:00 +0500 Subject: [PATCH 5/6] slight update to readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c356e8c..0f5903f 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ this user needs to own the jail directory, make sure to change ownership of the sudo chown -R fluxsftp:fluxsftp /srv/sftp ``` -***When u register a new user make sure to create a directory for them in the jail directory and make sure it is owned by the fluxsftp user*** +***When you register a new user make sure to create a directory for them in the jail directory and make sure it is owned by the fluxsftp user*** ## Enable and Start after you have configured the database you can start the server as follows From 402d9a5b82bf11741a0d3cfb70dfc07abb2b3c8f Mon Sep 17 00:00:00 2001 From: RafayAhmad7548 Date: Thu, 10 Jul 2025 20:32:08 +0500 Subject: [PATCH 6/6] key setup readme --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f5903f..271945d 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,16 @@ sudo chown -R fluxsftp:fluxsftp /srv/sftp ***When you register a new user make sure to create a directory for them in the jail directory and make sure it is owned by the fluxsftp user*** +## Server Key +generate a key for the server as follows +```bash +sudo ssh-keygen -t ed25519 -f /etc/flux-sftp/server_key +``` +also make sure that the server's private key is owned by fluxsftp +```bash +sudo chown fluxsftp:fluxsftp /etc/flux-sftp/server_key +``` + ## Enable and Start after you have configured the database you can start the server as follows ```bash @@ -46,7 +56,7 @@ The configuration file is located at `/etc/flux-sftp/config.toml`, here is the d listen_address = "0.0.0.0" port = 2222 jail_dir = "/srv/sftp" -private_key_file = "~/.ssh/flux-sftp" +private_key_file = "/etc/flux-sftp/server_key" [database] driver = "sqlite"