From 12939ed7be65b3a3e45a3f39566fac1a741128b2 Mon Sep 17 00:00:00 2001 From: KYUNGMO TAK Date: Tue, 12 May 2026 16:43:49 +0900 Subject: [PATCH] First commit --- .gitignore | 2 ++ create_sftp.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++ create_sftp_start.sh | 5 +++++ create_sftp_stop.sh | 1 + 4 files changed, 54 insertions(+) create mode 100644 .gitignore create mode 100644 create_sftp.sh create mode 100644 create_sftp_start.sh create mode 100644 create_sftp_stop.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c4e518b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# 20260512 tak created gitignore +.DS_Store diff --git a/create_sftp.sh b/create_sftp.sh new file mode 100644 index 0000000..50cab58 --- /dev/null +++ b/create_sftp.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +#################################################################################################### +# # +# create SFTP, ver 1.0.0 05,April 2024 # +# # +# Copyright@2021 ATEC IoT Co.,Ltd All rights reserved # +# # +#################################################################################################### + +########################################### +# 1. Set sshd_config +########################################### + +sed -i '/^Subsystem\s\+sftp\s\+\/usr\/libexec\/sftp-server/d' /etc/ssh/sshd_config + +echo "Subsystem sftp internal-sftp" >> /etc/ssh/sshd_config +echo "Match Group cgeslsftp" >> /etc/ssh/sshd_config +echo " ChrootDirectory /sftp/" >> /etc/ssh/sshd_config +echo " ForceCommand internal-sftp -d %u" >> /etc/ssh/sshd_config + +########################################### +# 2. Create Account +########################################### + +groupadd cgeslsftp +useradd -s /sbin/nologin -g cgeslsftp cgeslsftp +echo 'cgeslsftp:cgESLPassword' | chpasswd + +########################################### +# 3. Create Account Directory +########################################### + +mkdir -p /sftp/Import +chown cgeslsftp:cgeslsftp /sftp/Import +chmod ugo+rw /sftp/Import + +########################################### +# 4. Reboot +########################################### + +reboot + +exit + +#################################################################################################### \ No newline at end of file diff --git a/create_sftp_start.sh b/create_sftp_start.sh new file mode 100644 index 0000000..95461fc --- /dev/null +++ b/create_sftp_start.sh @@ -0,0 +1,5 @@ +echo "Start Send CSV" +cd /home/root/ + +echo "Execute Send CSV" +./sendCSV.sh >/dev/null 2>&1 & \ No newline at end of file diff --git a/create_sftp_stop.sh b/create_sftp_stop.sh new file mode 100644 index 0000000..01b5e5c --- /dev/null +++ b/create_sftp_stop.sh @@ -0,0 +1 @@ +pkill -f sendCSV.sh \ No newline at end of file