apxtrib/adminapi/bash/sftpaccounttotribe.sh

65 lines
1.9 KiB
Bash

#!/bin/bash
# apXtrib
# @param action townId nationId tribeId appname user
# @return a symlink into /home/tribeId/www/appname to ~/workspace/townId-nationId/tribes/tribeId/www/appname
# @return a user is create to access in sftp the jail directory /home/tribeId/www/appname
#
# ./sftpaccounttotribe.sh wall ants smatchit smatchapp sagark
# @todo A faire
echo $1;
echo $2;
echo $3;
echo $4;
echo $5;
echo $6;
create_sshspace () {
# To activate sftp only into towniD-natinId/tribes/tribeId/www
# Create a linux account with the name tribeId
# $ sudo useradd tribeId
# $ passwd tribeId
# into /home/tribeswww/
# create /tribeId
# sudo mount --bind /home/phil/workspace/wall-ants/tribes/tribeId/www /home/tribeswww/tribeId
# add in /etc/fstab
# /home/phil/workspace/wall-ants/tribes/tribeId/www /home/tribeswww/tribeId none defaults,bind 0 0
#in /etc/ssh/sshd_config
#Match User smatchit
# ForceCommand internal-sftp
# ChrootDirectory /home/tribeswww/smatchit
# in /www/ need to add
# copy and past /bin dev/ /etc/ lib/ lib64/
# in /bin cp /bin/bash or /bin/sh depending of /etc/passwd SHELL (check /etc/default/useradd to change if needed)
# to check dependance $ ldd /bin/bash
# cp all /lib/x... and all /lib64/ into ./ (add same folder name,...)
# in /dev :
# $ sudo mknod -m 666 null c 1 3;sudo mknod -m 666 tty c 5 0; sudo mknod -m 666 zero c 1 5; sudo mknod -m 666 random c 1 8;
# check they are root $ ls -ld ../ if not $ chown -R root:root /dev
# $ chmod -R 0755 /dev
#$ sudo cp /etc/passwd ./etc/ Need to do each new user
#$ sudo cp /etc/group ./etc/ Need to do each new user
#
# To secure access nginx
# sudo apt install apache2-utils
# sudo htpasswd -c /townId-natiuonId/tribes/tribeId/.htpasswd user
# user: smatchit psw: sm@tch1t
}
create_user (){
#
#
#
}
case "$1" in
'add')
echo ""
create_user $5
;;
esac