forked from apxtri/apxtrib
69 lines
2.3 KiB
Bash
69 lines
2.3 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
|
|
# $ cd ~/workspace/towniD-natinId/tribes/tribeId/www
|
|
# 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
|
|
|
|
|
|
|
|
#sudo mkdir -p /home/tribeswww/smatchit/smatchapp
|
|
# cd /home/tribeswww/smatchit/smatchapp
|
|
# sudo vim
|
|
|
|
# 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;
|
|
# sudo chown root:root /home/tribeswww/smatchit/smatchapp
|
|
# sudo chmod 0755 /home/tribeswww/smatchit/smatchapp
|
|
# sudo mkdir -p /home/tribeswww/smatchit/smatchapp/bin
|
|
# sudo cp -v /bin/bash /home/tribeswww/smatchit/smatchapp/bin/
|
|
# sudo mkdir -p /home/tribeswww/smatchit/smatchapp/lib64
|
|
# check ldd /bin/bash
|
|
# sudo cp -v /lib64/{libtinfo.so.5,libdl.so.2,libc.so.6,ld-linux-x86-64.so.2} /home/tribeswww/smatchit/smatchapp/lib64/
|
|
# sudo useradd smatchapp;
|
|
# sudo passwd smatchapp;
|
|
# sudo mkdir /home/tribeswww/smatchit/smatchapp/etc
|
|
# sudo cp -vf /etc/{passwd,group} /home/tribeswww/smatchit/smatchapp/etc/ (this have to be done each time a new user is create)
|
|
#sudo vim /etc/ssh/sshd_config
|
|
|
|
}
|
|
|
|
create_user (){
|
|
#
|
|
#
|
|
#
|
|
}
|
|
|
|
case "$1" in
|
|
'add')
|
|
echo ""
|
|
create_user $5
|
|
;;
|
|
esac
|
|
|