简体   繁体   中英

Compiling program is not give me permission2 execute outpt of clang -o user.o|can't run user.o w/ sudo says command not found or sudo permision denied

So I compiled xdp program like

/usr/lib/x86_64-linux-gnu/

 sudo clang -Wall -L /usr/lib/x86_64-linux-gnu/ -I /usr/lib/usr/include/ -c af_xdp_user.c -o user.o 

or

 sudo clang -Wall -L /usr/lib/x86_64-linux-gnu/ -I /usr/lib/usr/include/ -c af_xdp_user.c -o user.o  -lbpf

generates user.o

but there is no use of user.o since ls -a not showing x just showing -wr for read write. when i run it like sudo./user.o message says sudo: ./user.o: command not found or without sudo bash: ./user.o: Permission denied so what eactly why I am unable to run the.o file, I used tro generate.o file and execute the like simple main program not using any libray or anything shared. I also tried to -o user and try to execute./user but same problem.

Can anyone please inform what am I doing wrong

I think you just have to add execute permissions to the file. Write this command in the terminal to do it:

sudo chmod a+x user.o

This command will add to all users execute permissions, so just typing

./user.o

will run the file.


If you don't want all users to be able to run the file, you can add execute permissions only to root, like this:

sudo chmod u+x user.o

In this case you will be able to run the program by typing

sudo ./user.o

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM