2023-05-31 13:19:21 +00:00
|
|
|
#!/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
|
|
|
|
|
2023-06-01 05:30:05 +00:00
|
|
|
# @todo A faire
|
2023-05-31 13:19:21 +00:00
|
|
|
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
|
2023-06-01 05:30:05 +00:00
|
|
|
# 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
|
2023-05-31 13:19:21 +00:00
|
|
|
# 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
|
2023-06-01 05:30:05 +00:00
|
|
|
#
|
|
|
|
# To secure access nginx
|
|
|
|
# sudo apt install apache2-utils
|
|
|
|
# sudo htpasswd -c /townId-natiuonId/tribes/tribeId/.htpasswd user
|
|
|
|
# user: smatchit psw: sm@tch1t
|
2023-05-31 13:19:21 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
create_user (){
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
}
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
'add')
|
|
|
|
echo ""
|
|
|
|
create_user $5
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|