Permissions?

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: der.hans
Date:  
Subject: Permissions?
Am 15. Jul, 2001 schwäzte Clayton Stapleton so:

> I am trying to write a simple C program so that I can learn how to use
> C. I have no trouble writing the program and creating the ex01-1.c file. I
> can compile the ex01-1.c file and obtain the ex01-1.0 file and then link
> the pieces to obtain the executable file ex01-1. When I run ex01-1 file


BTW, if you have gnu make installed ( which you should on Linux ), then you
can do this in one step without a Makefile.

make fred

In the absense of a Makefile, make will look for a fred.c and fred.h and
then compile fred.c with the default c compiler, placing the executable in
fred.

It does other stuff, but I use the c functionality.

> I get the permission denied and do not know how to get rid of it. As
> shown below I have adjusted all the permissions that I can think of to no
> avail. Any help will be appreciated.
>
> clay@linux:/data4/C-Prog/Horton/les01 > ls -l
> -rwxrwxr-x    1 clay     users        4838 Jul 13 06:39 ex01-1


That looks like what you need.

> -rw-r--r--    1 clay     users         127 Jul 13 06:36 ex01-1.c
> -rw-r--r--    1 clay     users         912 Jul 13 06:37 ex01-1.o

>
> clay@linux:/data4/C-Prog/Horton/les01 > ex01-1
> bash: ./ex01-1: Permission denied
>
> clay@linux:~ > ls -l /
> drwxrwxr-x    4 root     users        4096 Jul 13 06:30 data4

>
> clay@linux:~ > cat /etc/fstab
> /dev/hdc2       /data4  auto    noauto,user 0 0

>
> clay@linux:~ > ls -l /dev/hdc2
> brw-rw----    1 root     users     22,   2 Jan 19 01:36 /dev/hdc


This doesn't matter. You're not accessing the disk space via the raw device,
so it's perms for the filesystem that matter.

Have you used file on ex01-1 to make sure it's an executable.

$ file /bin/bash
/bin/bash: ELF 32-bit LSB executable, Intel 80386, version 1, dynamically
linked (uses shared libs), stripped

ciao,

der.hans
--
# home.pages.de/~lufthans/ www.DevelopOnline.com
# Science is magic explained. - der.hans