User Tools

Site Tools


ubuntu:setuid

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
ubuntu:setuid [2018/02/18 05:49]
tschulz created
ubuntu:setuid [2018/02/18 05:54] (current)
tschulz
Line 1: Line 1:
 ====== setUID ====== ====== setUID ======
 +===== SetUid C source =====
  
-<​file>​+<​file ​c setuidtest.c>
 #include <​stdio.h>​ #include <​stdio.h>​
 #include <​sys/​types.h>​ #include <​sys/​types.h>​
 #include <​unistd.h>​ #include <​unistd.h>​
 +#include <​stdlib.h>​
 int main(void) int main(void)
 { {
Line 25: Line 27:
 } }
 </​file>​ </​file>​
 +
 +===== Compile and chmod =====
 +<file bash>
 +gcc -o setuidtest setuidtest.c
 +chmod u+s setuidtest
 +</​file>​
 +
 +===== Read from stdin =====
 +<file c>
 +char buf[1];
 +
 +while(read(0,​ buf, sizeof(buf))>​0) {
 +   // read() here read from stdin charachter by character
 +   // the buf[0] contains the character got by read()
 +   ....
 +}
 +</​file>​
 +
  
ubuntu/setuid.1518954583.txt.gz · Last modified: 2018/02/18 05:49 by tschulz