Results 1 to 3 of 3

Thread: Permission denied when trying to run compiled C file in Nethunter terminal Nexus 6

  1. #1
    Join Date
    2016-Feb
    Posts
    1

    Permission denied when trying to run compiled C file in Nethunter terminal Nexus 6

    I've successfully installed Nethunter on my Nexus 6. I compiled the helloword program that was written in C with the following command: gcc helloworld.c -o helloworld
    It compiled just fine. But when i try to run it in the Nethunter terminal using: ./helloworld , it gives me permission denied.
    I tried all sorts of chmod and sudo but it still doesn't work.
    I also tried ls -l helloworld and it gives me: rw-rw---- , there are no x.
    How can I make this program run? It's driving me nuts!

  2. #2
    What kinds of chmod commands did you try? Do these two make any difference?
    Code:
    chmod +x helloworld
    chmod 750 helloworld
    Is there any possibility that your chmod command and ls command are acting on different files? e.g.
    Code:
    root@kali/~>chmod +x helloworld.c
    root@kali/~>ls -l helloworld
    would cause the situation you have now as the file whose permissions you are changing is not the one you are checking the permissions of (not that I haven't wasted hours in the past with similar typos at all, compounded by the convenience of recalling previous commands rather than actually typing them).

    Sorry it's not really a solution but might help you step back and have an aha moment.

  3. #3
    I know this is a late reply......but this might be useful to someone else
    First create your c program in some directory like /sdcard/
    Then go to Nethunter Terminal and go to the directory
    Then move the file to the root directory of Nethunter using the command
    root@kali:mv filename.c /filename.c
    Now compile the program
    root@kali:gcc filename.c
    Now change the permissions of a.out
    root@kali:chmod +x a.out
    Now run your program
    root@kali:./a.out
    😉
    The thing you have to understand is that the root directory of your phone is different from the root directory of your Nethunter

Similar Threads

  1. "Permission denied" in NetHunter Chroot (LOS)
    By LRitzdorf in forum Installing NetHunter
    Replies: 4
    Last Post: 2022-01-29, 00:45

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •