Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I once generated an executable file using g++ on a linux box. But when I try to run this executable file on another linux machine, the system said "Permission denied". However, after I re-compile the source code on this second machine and run the executable file, the program just runs fine.

Can you let me know what may be the problem? Thanks.

share|improve this question

migrated from stackoverflow.com Mar 20 '11 at 23:42

This question came from our site for professional and enthusiast programmers.

3  
what are the permissions bits of the file? Try: chmod +x <file> –  Yves Junqueira Mar 20 '11 at 22:16
    
This question really belongs on unix.se. –  Ben Voigt Mar 20 '11 at 23:20
    
Perhaps the partition that you're trying to execute the file is mounted with the noexec flag activated? –  faif Mar 21 '11 at 9:09
add comment

1 Answer 1

At a guess, you copied it over with a utility that doesn't preserve file modes. Try chmod +x.

share|improve this answer
    
Ten rep points says he used ftp and the default umask strips the -x bit on uploads. Not a bad precaution, come to think of it... –  Shadur Mar 21 '11 at 8:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.