forked from GreyDGL/PentestGPT
-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathfix-workspace-permissions.sh
More file actions
executable file
·39 lines (31 loc) · 1.12 KB
/
fix-workspace-permissions.sh
File metadata and controls
executable file
·39 lines (31 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# Quick fix for workspace permissions issue
set -e
# Colors
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${BLUE}PentestGPT Workspace Permission Fix${NC}\n"
# Check if workspace exists
if [ ! -d "./workspace" ]; then
echo -e "${BLUE}Creating workspace directory...${NC}"
mkdir -p ./workspace
echo -e "${GREEN}✓ Created workspace directory${NC}\n"
exit 0
fi
# Check current owner
OWNER=$(stat -c '%U' ./workspace 2>/dev/null || stat -f '%Su' ./workspace 2>/dev/null)
echo -e "${BLUE}Current workspace owner: ${NC}${OWNER}"
if [ "$OWNER" = "root" ]; then
echo -e "${BLUE}Fixing permissions (requires sudo)...${NC}"
sudo chown -R $(id -u):$(id -g) ./workspace
echo -e "${GREEN}✓ Fixed workspace permissions${NC}"
echo -e "${BLUE}New owner: ${NC}$(whoami)\n"
else
echo -e "${GREEN}✓ Workspace permissions are correct${NC}\n"
fi
echo -e "${BLUE}Rebuilding Docker image with updated code...${NC}"
docker-compose build
echo -e "\n${GREEN}✓ All done! You can now run:${NC}"
echo -e " ${NC}docker-compose run --rm pentestgpt --target example.com${NC}\n"