I am following this tutorial, Lesson 22.
I am doing so on Ubuntu 19.10 x86_64 with NASM version 2.14.02.
It is suppose to create a file, readme.txt and set 777 permissions on it (-rwxrwxrwx).
mov ecx, 0777 ; set all permissions to read, write, execute
mov ebx, filename ; filename we will create
mov eax, 8 ; invoke SYS_CREAT (kernel opcode 8)
int 80h ; call the kernel
I am using the compile/link command as indicated in the above tutorial :
; Compile with: nasm -f elf create.asm
; Link with (64 bit systems require elf_i386 option): ld -m elf_i386 create.o -o create
; Run with: ./create
When running the create program, the file is created but permissions are not 777 but :
-r----x--t 1 cptam cptam 0 Apr 5 21:41 readme.txt
I can't figure out why the 0777 becomes, if I am not mistaken, 1510. Could anyone explain me how to, correctly set the permissions on a file?
Thanks!