Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-15-2013, 01:12 AM   #1
LQ Newbie
Registered: Feb 2013
Posts: 1

Rep: Reputation: Disabled
Question EXE not working when copied from one linux machine to another


I executed a C program in a linux terminal,then the generated .exe file, I copied it into another linux machine which has very limited functionalities dedicated to run a special software , there this .exe file is not working,
"command not found"
Old 02-15-2013, 02:08 AM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,412

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
"command not found" generally means the location of the prog is not in your path; try giving the absolute path.
It can mean wrong perms/ownerships.

If that doesn't work, show the exact cmd & error and show
echo $PATH
cat /etc/*release*
uname -a
from both systems.
Old 02-15-2013, 09:29 AM   #3
Registered: Mar 2011
Location: Sutton, MA. USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu
Posts: 5,844
Blog Entries: 12

Rep: Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010Reputation: 2010
My assumption here is that you're using the verbiage .exe file to indicate a binary executable which was generated by a compiler to run on Linux. Because what you wrote doesn't sound accurate:

I executed a C program in a linux terminal,then the generated .exe file
What I'm thinking is that you "wrote" a C program, "compiled" it in a terminal shell and the result was an executable file.

Question #1 is did that file run at the time it was created?

Next, after you copied the file, there are several things which you need to check on the other system.

1. What is the user name on that other system which you're using? What group is that user part of?
2. When you copied the file over, which username ended up owning the file? What were the file's full attributes insofar as privileges, ownership, and group?

If you perform "ls -l" from the directory in which that file is located, you'll see the information I'm indicating.

For instance, here is an example of something that likely would not work.

me@my-desktop:~/testcode$ ls -l
total 132
-rwxr--r-- 1 root   root  294912 2012-09-25 12:05 binary-tool
-rwxr-xr-x 1 me     users   1220 2012-03-06 14:24 crc-tool
I made that up from a general ls command, my points here are:

Logged in as "me", I can see binary-tool; however the permissions are the left-most chunk of that, nothing is a symbolic link or a directory, that's the first dash "-", then you see tri-groups of permissions for "owner", "group", and "world". Followed by owner name and group name.

binary-tool is owned by root, and is in the group root.
binary-tool has permissions for owner to be rwx = read, write, execute
binary-tool has permissions for group and world to be r-- = read

crc-tool is owned by me, and is in the group users.
crc-tool has permissions for owner to be rwx = read, write, execute
crc-tool has permissions for group and world to be r-x = read, execute

This all means that user "me", which is "who I'm logged in as for purposes of my example" can "see" binary-tool, but cannot delete it, nor run it. However "me" owns crc-tool, can read it, write it (and thus delete it), and can execute it.

It is possible that a file can be placed into your user directory which you do not own, nor do not have access, nor privileges too.

If this is the case, then you need to use things (logged in as root, or using sudo) like "chown" - to change owner, "chgrp" - to change the group, and "chmod" - to change the file privileges.

You may not be able to run this because you may either not be able to execute it, nor even access it as the user you are logged in as. And even if you're root, if the file is owned by "nobody" in group "nowhere" it may still be inaccessible if the privileges are "-r--r--r--", where you can see it, but do little else.

The $PATH variable is important; however in order to run anything from within the directory where you are at in your shell, you can always do, "./binary-tool", and that will run it.

In the particular case I've shown here, I would do the following:

sudo chown me binary-tool
sudo chgrp users binary-tool
chmod 755 binary-tool
However you may need to do things differently depending on what your situation is.

If you find that you either don't understand, or still cannot resolve; please perform "ls -l" in the directory where your binary executable is located so that we can see the attributes of the file, and also relate your environment by typing "env" and pasting the output of that into a message here as well.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
real last modified date... not when copied to machine mike_stlouis Linux - Newbie 3 08-28-2009 02:17 PM
autorun.exe and *.exe for linux eutalia2000 Linux - Newbie 3 12-23-2008 07:31 AM
samba compatibility with microsoft srvtools.exe (usrmgr.exe and srvmgr.exe) checkmate3001 Linux - Software 1 09-06-2008 06:08 AM
SSH forward from a Windows machine to a Linux machine isn't working nickj6282 Linux - Networking 3 08-13-2006 03:47 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:10 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration