#!/bin/sh # ===================================================================== # Projet : DARKCONTAINER # Fichier : bin/dirfileright # Auteur : Nicolas "DarkHack" Chapuis (c) 2026 # ================== DARKHACK ================== # [ darkweb.fr - system online ] # Powered by Perplexity, your AI assistant # https://www.perplexity.ai # ============================================== # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ===================================================================== racineSh="${racineSh:-/etc/darksh}" rootDarkMake="${rootDarkMake:-/etc/darkmake}" rootDarkContainer="${rootDarkContainer:-/etc/darkcontainer}" if ! type "shInclude" > /dev/null; then . "$racineSh/lib/shTools";fi shLog="${shLog:-dirfilerigth}" shDebugEnable="1" pChrootDir="$1" pDirUserGroupRight="$2" if [ -z "$pChrootDir" ] || [ -z "$pDirUserGroupRight" ];then shDebug 0 ""$log" is empty [pChrootDir:$pChrootDir or pDirUserGroupRight:$pDirUserGroupRight]" else shDebug 1 ""$log" $* ----------------- start [pChrootDir:$pChrootDir,pDirUserGroupRight:$pDirUserGroupRight]" #|-------------------------------------------------------------| #| which "base" tools : cp | rm | echo | head | tail | #|-------------------------------------------------------------| # &&&&& #|-----------------------------------------------------------------------| #| which "directory" tools : mkdir | chmod | chgrp | mount | umount | #|-----------------------------------------------------------------------| # &&&&& #|------------------------------------------------------------------------------------| #| which "user right" tools : chmod | chown | chgrp | groupadd | useradd | chroot | #|------------------------------------------------------------------------------------| $(shInclude ${rootDarkContainer}/which/lib/base) && $(shInclude ${rootDarkContainer}/which/lib/directory) && $(shInclude ${rootDarkContainer}/which/lib/userRight) $(shInclude ${rootDarkContainer}/lib/chroot) && $(shInclude ${rootDarkContainer}/lib/systemctl) && $(shInclude ${rootDarkContainer}/lib/rsyslog) #user:group:rwx,rwx,rwx:file #pDirUserGroupRight="$pDirUserGroupRight user:group:rwx,rwx,rwx:file" shDebug 1 ""$log" chroot pDirUserGroupRight $pDirUserGroupRight" for dataUsersRight in $(echo $pDirUserGroupRight);do if [ -z "$dataUsersRight" ];then continue;fi durUser="$(echo $dataUsersRight | cut -f 1 -d':')" durGroup="$(echo $dataUsersRight | cut -f 2 -d':')" durRight="$(echo $dataUsersRight | cut -f 3 -d':')" durFile="$(echo $dataUsersRight | cut -f 4- -d':')" dirRightOwn="$(echo $durRight | cut -f1 -d',')" dirRightGroup="$(echo $durRight | cut -f2 -d',')" dirRightOther="$(echo $durRight | cut -f3 -d',')" shDebug 1 ""$log" chroot_install durFile:$durFile /$durUser/$durGroup" if [ ! -d "$pChrootDir/$durFile" ];then mkdir -p $pChrootDir/$durFile;fi chroot_root_execute $pChrootDir $cmdChmod a-rwx -R $durFile if [ -n "$dirRightOwn" ];then chroot_root_execute $pChrootDir $cmdChmod u+$dirRightOwn -R $durFile;echo $pChrootDir $cmdChmod u+$dirRightOwn -R $durFile;fi if [ -n "$dirRightGroup" ];then chroot_root_execute $pChrootDir $cmdChmod g+$dirRightGroup -R $durFile;echo $pChrootDir $cmdChmod g+$dirRightOwn -R $durFile;fi if [ -n "$dirRightOther" ];then chroot_root_execute $pChrootDir $cmdChmod a+$dirRightOther -R $durFile;echo $pChrootDir $cmdChmod a+$dirRightOwn -R $durFile;fi chroot_root_execute $pChrootDir $cmdChown -R $durUser:$durGroup $durFile echo $pChrootDir $cmdChown -R $durUser:$durGroup $durFile done fi