look at this function:
Code: Select all
int chmod(const char *path, mode_t mode);
Code: Select all
S_ISUID (04000) set-user-ID (set process effective user ID on
execve(2))
S_ISGID (02000) set-group-ID (set process effective group ID on
execve(2); mandatory locking, as described in
fcntl(2); take a new file's group from parent direcق
tory, as described in chown(2) and mkdir(2))
S_ISVTX (01000) sticky bit (restricted deletion flag, as described in
unlink(2))
S_IRUSR (00400) read by owner
S_IWUSR (00200) write by owner
S_IXUSR (00100) execute/search by owner ("search" applies for direcق
tories, and means that entries within the directory
can be accessed)
S_IRGRP (00040) read by group
S_IWGRP (00020) write by group
S_IXGRP (00010) execute/search by group
S_IROTH (00004) read by others
S_IWOTH (00002) write by others
S_IXOTH (00001) execute/search by others
this code first print hello then change file permission and then exit
print and exit are success but not change file permission
i asked in many forums but no one didn't help ,
code:
Code: Select all
section .text
global _start
_start:
mov eax,15
mov ebx,path
mov ecx,mod
int 0x80
mov edx,len
mov ecx,msg
mov ebx,1
mov eax,4
int 0x80
mov ebx,0
mov eax,1
int 0x80
section .data
msg db "Hello",0xa
len equ $ - msg
path db "/root/Desktop/xpl/1.txt"
mod db "S_IWUSR|S_IWGRP|S_IWOTH"
anyone can tell me how i do it ? thanks