srl-labs / clabernetes

containerlab, but in kubernetes!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Directory Permissions

steiler opened this issue · comments

PermissionsEveryoneReadUserWrite (https://github.com/srl-labs/clabernetes/blob/main/constants/os.go#L23) defined the permissions for all the Kubernetes Resources created as files but also for the directories.

The x (execute) permission on a directory actually is basically the -> list folder content permission.
So we need a different const for folders and files.

This is where the output dir is created.
https://github.com/srl-labs/clabernetes/blob/main/clabverter/clabverter.go#L147

    INFO |                clabverter | rendering clabernetes extra file(s) outputs...
   DEBUG |                clabverter | handling extra file(s) complete
   DEBUG |                clabverter | handling associated file(s) complete
CRITICAL |                clabverter | failed writing 'srl1-statup-config' to output directory: open /home/mava/projects/clabernetes/workdir/converted/srl1-startup-config.yaml: permission denied
panic: open /home/mava/projects/clabernetes/workdir/converted/srl1-startup-config.yaml: permission denied

See, folder exists and I own it.
However I cannot list content.
But root can and this shows that still I'm the owner.

mava@server01:~/projects/clabernetes/workdir$ ls -lah
total 12K
drwxrwxr-x  3 mava mava 4.0K Oct  9 11:29 .
drwxrwxr-x 25 mava mava 4.0K Oct  9 11:28 ..
drw-r--r--  2 mava mava 4.0K Oct  9 11:29 converted
mava@server01:~/projects/clabernetes/workdir$ ls -lah converted/
ls: cannot access 'converted/..': Permission denied
ls: cannot access 'converted/.': Permission denied
total 0
d????????? ? ? ? ?            ? .
d????????? ? ? ? ?            ? ..
mava@server01:~/projects/clabernetes/workdir$ sudo ls -lah converted/
total 8.0K
drw-r--r-- 2 mava mava 4.0K Oct  9 11:29 .
drwxrwxr-x 3 mava mava 4.0K Oct  9 11:29 ..
mava@server01:~/projects/clabernetes/workdir$

wowow GitHub auto closing. anyway, tested what you showed me in chat and simplified the terrible perms naming/setup, so should be good!