Ubuntu Pastebin

Paste from Chad Smith at Thu, 14 Sep 2017 17:47:09 +0000

Download as text
 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
#xenial bare-metal

csmith@uptown:~$ chmod 400 read-only 
csmith@uptown:~$ ls -l read-only 
-r-------- 1 csmith csmith 3 Sep 14 11:40 read-only
csmith@uptown:~$ python3 -c "import os; os.access('read-only', os.W_OK)"
csmith@uptown:~$ python3 -c "import os; print(os.access('read-only', os.W_OK))"
False
csmith@uptown:~$ touch read-write
csmith@uptown:~$ vi read-write 
csmith@uptown:~$ ls -l read-write 
-rw-rw-r-- 1 csmith csmith 0 Sep 14 11:41 read-write
csmith@uptown:~$ chmod 600 read-write 
csmith@uptown:~$ python3 -c "import os; print(os.access('read-write', os.W_OK))"
True



# zesty container
root@pro-gibbon:~/cloud-init# touch read-only
root@pro-gibbon:~/cloud-init# chmod 400 read-only
root@pro-gibbon:~/cloud-init# touch read-write
root@pro-gibbon:~/cloud-init# touch 600 read-write
root@pro-gibbon:~/cloud-init# python3 -c "import os; print(os.access('read-only', os.W_OK))"
True
root@pro-gibbon:~/cloud-init# python3 -c "import os; print(os.access('read-write', os.W_OK))"
True
Download as text