Guest User

Untitled

a guest
Jul 24th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. [robin@xps ~ ]$ lxc launch ubuntu:16.04 my-xenial # Create & start a new container
  2. [robin@xps ~ ]$ getfacl ./share/ # Check extended permissions on "share" directory
  3. # file: share
  4. # owner: robin
  5. # group: robin
  6. user::rwx
  7. group::rwx
  8. other::r-x
  9. [robin@xps ~ ]$ sudo ls -ld /var/lib/lxd/containers/my-xenial # Find the user ID for my container (165536)
  10. [sudo] password for robin:
  11. drwxr-xr-x+ 4 165536 165536 4096 May 13 08:59 /var/lib/lxd/containers/my-xenial
  12. [robin@xps ~ ]$ # Give my container access to the "share" directory
  13. [robin@xps ~ ]$ setfacl -Rm user:lxd:rwx,default:user:lxd:rwx,user:165536:rwx,default:user:165536:rwx share
  14. [robin@xps ~ ]$ getfacl share # Behold the new expanded permissions!
  15. # file: share
  16. # owner: robin
  17. # group: robin
  18. user::rwx
  19. user:lxd:rwx
  20. user:165536:rwx
  21. group::rwx
  22. mask::rwx
  23. other::r-x
  24. default:user::rwx
  25. default:user:lxd:rwx
  26. default:user:165536:rwx
  27. default:group::rwx
  28. default:mask::rwx
  29. default:other::r-x
  30. [robin@xps ~ ]$ # Add the shared directory to the container as a device
  31. [robin@xps ~ ]$ lxc config device add my-xenial share disk source=`pwd`/share path=/srv/share
  32. Device share added to my-xenial
  33. [robin@xps ~ ]$ # I can now successfully create a new file in the shared directory
  34. [robin@xps ~ ]$ lxc exec my-xenial -- touch /srv/share/anewfile
  35. [robin@xps ~ ]$ ls -l share/anewfile
  36. -rw-rw-r--+ 1 165536 165536 0 May 13 14:22 share/anewfile
Add Comment
Please, Sign In to add comment