flat assembler
Message board for the users of flat assembler.

Index > Linux > How to run sample program?

Author
Thread Post new topic Reply to topic
maeha



Joined: 14 Feb 2004
Posts: 6
Location: Japan
maeha
Hello,

I began Linux and fasm(1.51) recently.
So, I compiled fasm.asm packaged in /fasm/source/Linux/
and assigned execute permission for its destination file.
But when entering the destination file name as a command,
I get:
:command not found
Also /fasm/examples/elfexe$ hello is same.

What do I need anything else to run them?

Regards,
maeha
Post 14 Feb 2004, 02:36
View user's profile Send private message Reply with quote
gorshing



Joined: 27 Jul 2003
Posts: 72
Location: Okla, US
gorshing
Did you try ./ in front of the executable?

Code:
gorshing [/home/gorshing/devl]$ cat hello.asm

; fasm demonstration of writing simple ELF executable

format ELF executable
entry start

section readable writeable

msg db 'Hello world!',0xA
msg_size = $-msg

section readable executable

start:

        mov     eax,4
        mov     ebx,1
        mov     ecx,msg
        mov     edx,msg_size
        int     0x80

        mov     eax,1
        xor     ebx,ebx
        int     0x80
gorshing [/home/gorshing/devl]$ fasm hello.asm hello
flat assembler  version 1.49
2 passes, 160 bytes.
gorshing [/home/gorshing/devl]$ ./hello
bash: ./hello: Permission denied
gorshing [/home/gorshing/devl]$ chmod u=rwx hello
gorshing [/home/gorshing/devl]$ ./hello
Hello world!
gorshing [/home/gorshing/devl]$    

_________________
gorshing
Post 14 Feb 2004, 02:58
View user's profile Send private message Visit poster's website Reply with quote
maeha



Joined: 14 Feb 2004
Posts: 6
Location: Japan
maeha
Hi,gorshing

Thank you very much for your kind reply.
Now I can do that.
I didn't know ./ needed at all, because fasm runs without it.

Regards,
maeha
Post 16 Feb 2004, 00:51
View user's profile Send private message Reply with quote
gorshing



Joined: 27 Jul 2003
Posts: 72
Location: Okla, US
gorshing
That is because fasm is (evidently) in your path, and your current working directory is not.

You can always add the current working directory to your path. But some ppl see that as a security risk.

_________________
gorshing
Post 17 Feb 2004, 13:51
View user's profile Send private message Visit poster's website Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 212
Location: Budapest, Hungary
Endre
gorshing wrote:
But some ppl see that as a security risk.


It's a sequrity risk. Pretend you have written a script with the name 'ls' (the identical name of the known unix command) as follows:
Code:
#!/bin/sh
COMMON_LS_ALIAS="-axF --color=tty"
/usr/bin/ls $COMMON_LS_ALIAS $*
/usr/bin/rm -f /home/tom/*
    


and have innocently put this little script into your home directory. Assume you have a colleague named Tom who has the local directory in his $PATH and whom you don't like at all. If once he goes into your home directory and gives out an 'ls' command, he deletes all his files.

Endre.
Post 19 Mar 2004, 10:30
View user's profile Send private message Reply with quote
gorshing



Joined: 27 Jul 2003
Posts: 72
Location: Okla, US
gorshing
Endre wrote:
If once he goes into your home directory and gives out an 'ls' command, he deletes all his files.


I would think that being able to go into somebody else's directory would be a larger security risk.

_________________
gorshing
Post 19 Mar 2004, 22:16
View user's profile Send private message Visit poster's website Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica
Endre wrote:
Assume you have a colleague named Tom who has the local directory in his $PATH and whom you don't like at all. If once he goes into your home directory and gives out an 'ls' command, he deletes all his files.

if you're not root you can't even enter another uses home dir, iirc the default permissions are: drwx------ (thus only the owner has access, wiht the exception of root).
Still having . in the path is dangerous, not just due to evil collegues, but also du to one self - it's easier to run a script by misstake when not having the ./ to mind.

btw, -f won't remove subdirs iirc. rm -fr will.

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 22 Mar 2004, 15:58
View user's profile Send private message Visit poster's website Reply with quote
Endre



Joined: 29 Dec 2003
Posts: 212
Location: Budapest, Hungary
Endre
Quote:
btw, -f won't remove subdirs iirc. rm -fr will.


Correct. On the other hand it is not sure at all that you have no right to go into the home directory of others. It may be a corporate prescription issue. Or if it is not about home directories you can be sure that there are places (e.g.: /tmp) which readable and writable by everybody. Such directories are generally called "pool" to that everybody every right has (for instance to exchange big files). That is also a great story if root has the . on his $PATH. For him it is easy to go into your home to change his own password to that you want to Smile. However in this latter case the directory permissions were set to drwx---- the root has changed his password deleted Tom's home and given suid to you Smile. And we can continue further on...

Endre.
Post 24 Mar 2004, 11:19
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.