File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # ## AUTOMATIC SFTP-ONLY (NO-SSH LOGIN) USER GENERATOR BY WEBSTACK.UP
3
+ # https://github.com/TurboLabIt/webstackup/tree/master/script/account/generate-sftp-only-user.sh
4
+ #
5
+ # sudo apt update && sudo apt install curl -y && curl -s https://raw.githubusercontent.com/TurboLabIt/webstackup/master/script/account/generate-sftp-only-user.sh | sudo WSU_SFTP_ONLY_USERNAME=my-user bash
6
+
7
+ # # bash-fx
8
+ if [ -f " /usr/local/turbolab.it/bash-fx/bash-fx.sh" ]; then
9
+ source " /usr/local/turbolab.it/bash-fx/bash-fx.sh"
10
+ else
11
+ source <( curl -s https://raw.githubusercontent.com/TurboLabIt/bash-fx/main/bash-fx.sh)
12
+ fi
13
+ # # bash-fx is ready
14
+
15
+ fxHeader " π€ SFTP-only user generator"
16
+ rootCheck
17
+
18
+
19
+ if [ ! -z " ${1} " ]; then
20
+ WSU_SFTP_ONLY_USERNAME=${1}
21
+ fi
22
+
23
+ if [ -z " ${WSU_SFTP_ONLY_USERNAME} " ]; then
24
+ fxCatastrophicError " You must provide the new username as argument or WSU_SFTP_ONLY_USERNAME"
25
+ fi
26
+
27
+
28
+ # # installing/updating WSU
29
+ WSU_DIR=/usr/local/turbolab.it/webstackup/
30
+ if [ -f " ${WSU_DIR} setup-if-stale.sh" ]; then
31
+ " ${WSU_DIR} setup-if-stale.sh"
32
+ else
33
+ curl -s https://raw.githubusercontent.com/TurboLabIt/webstackup/master/setup.sh | sudo bash
34
+ fi
35
+
36
+ source " ${WSU_DIR} script/base.sh"
37
+
38
+
39
+ fxTitle " π¨βπ©βπ§βπ§ Generating the sftp-only group..."
40
+ if ! getent group " sftp-only" & > /dev/null; then
41
+ groupadd --system sftp-only
42
+ else
43
+ fxInfo " sftp-only group already exists, skipping π¦"
44
+ fi
45
+
46
+
47
+
48
+
49
+
50
+ fxEndFooter
You canβt perform that action at this time.
0 commit comments