FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 05-25-2010, 12:27 PM
Jatin Davey
 
Default Unable to execute a script , Permission denied

Hi

I have a linux box which has CentOS running in it. I logged into the box
using root and wrote a script in the /home/proc_threads directory. saved
the file and quit. I changed the file permissions such that any user
could execute it using the "chmod 777 filename" command.

When i log out and log in as a non-root user i was not able to execute
the script though.

Could some one please help in this regard. I am a newbie to linux.

Thanks
Jatin
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-25-2010, 12:50 PM
Jakub Jedelsky
 
Default Unable to execute a script , Permission denied

On 25.5.2010 14:27, Jatin Davey wrote:


Hi

I have a linux box which has CentOS running in it. I logged into the box
using root and wrote a script in the /home/proc_threads directory. saved
the file and quit. I changed the file permissions such that any user
could execute it using the "chmod 777 filename" command.

When i log out and log in as a non-root user i was not able to execute
the script though.

Could some one please help in this regard. I am a newbie to linux.

Thanks
Jatin
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos





Hi,



have another users access to /home/proc_threads directory? Don't you
call any functions from script which can be executed only by root..?

Send us the exact error which you get after execute your script as an
user.. If it is a bash script, you can debug it with "-x" option..



Excuse my english



Jakub J.



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-25-2010, 12:56 PM
kalinix
 
Default Unable to execute a script , Permission denied

On Tue, 2010-05-25 at 17:57 +0530, Jatin Davey wrote:


Hi

I have a linux box which has CentOS running in it. I logged into the box
using root and wrote a script in the /home/proc_threads directory. saved
the file and quit. I changed the file permissions such that any user
could execute it using the "chmod 777 filename" command.

When i log out and log in as a non-root user i was not able to execute
the script though.

Could some one please help in this regard. I am a newbie to linux.

Thanks
Jatin
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos




Maybe wrong SElinux context?












Calin



Key fingerprint = 37B8 0DA5 9B2A 8554 FB2B 4145 5DC1 15DD A3EF E857



=================================================

Like winter snow on summer lawn, time past is time gone.





_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-25-2010, 12:56 PM
James Hogarth
 
Default Unable to execute a script , Permission denied

On 25 May 2010 13:27, Jatin Davey <jashokda@cisco.com> wrote:
> Hi
>
> I have a linux box which has CentOS running in it. I logged into the box
> using root and wrote a script in the /home/proc_threads directory. saved
> the file and quit. I changed the file permissions such that any user
> could execute it using the "chmod 777 filename" command.
>
> When i log out and log in as a non-root user i was not able to execute
> the script though.
>
> Could some one please help in this regard. I am a newbie to linux.
>
> Thanks
> Jatin
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>

1) Does the non-root user have access to the /home/proc_threads directory?
2) Is your home partition mounted noexec?

James
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-25-2010, 12:57 PM
Jatin Davey
 
Default Unable to execute a script , Permission denied

On 5/25/2010 6:20 PM, Jakub Jedelsky wrote:


On 25.5.2010 14:27, Jatin Davey wrote:


Hi

I have a linux box which has CentOS running in it. I logged into the box
using root and wrote a script in the /home/proc_threads directory. saved
the file and quit. I changed the file permissions such that any user
could execute it using the "chmod 777 filename" command.

When i log out and log in as a non-root user i was not able to execute
the script though.

Could some one please help in this regard. I am a newbie to linux.

Thanks
Jatin
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos





Hi,



have another users access to /home/proc_threads directory? Don't you
call any functions from script which can be executed only by root..?

Send us the exact error which you get after execute your script as an
user.. If it is a bash script, you can debug it with "-x" option..



Excuse my english



Jakub J.



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Here is the script that i am trying to execute as a non-root user:



#!/bin/sh

ps -C java -o thcount > /home/proc_threads/tempfile

awk ' { total += $1 } END { print total } ' /home/proc_threads/tempfile



here is the output when i try to execute as a non-root user:



./javathreads: line 2: /home/proc_threads/tempfile: Permission denied

awk: cmd. line:1: fatal: cannot open file `/home/proc_threads/tempfile'
for reading (Permission denied)



Thanks

Jatin



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-25-2010, 01:03 PM
Jakub Jedelsky
 
Default Unable to execute a script , Permission denied

On 25.5.2010 14:57, Jatin Davey wrote:


On 5/25/2010 6:20 PM, Jakub Jedelsky wrote:


On 25.5.2010 14:27, Jatin Davey wrote:


Hi

I have a linux box which has CentOS running in it. I logged into the box
using root and wrote a script in the /home/proc_threads directory. saved
the file and quit. I changed the file permissions such that any user
could execute it using the "chmod 777 filename" command.

When i log out and log in as a non-root user i was not able to execute
the script though.

Could some one please help in this regard. I am a newbie to linux.

Thanks
Jatin
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos





Hi,



have another users access to /home/proc_threads directory? Don't you
call any functions from script which can be executed only by root..?

Send us the exact error which you get after execute your script as an
user.. If it is a bash script, you can debug it with "-x" option..



Excuse my english



Jakub J.


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


Here is the script that i am trying to execute as a non-root user:



#!/bin/sh

ps -C java -o thcount > /home/proc_threads/tempfile

awk ' { total += $1 } END { print total } ' /home/proc_threads/tempfile



here is the output when i try to execute as a non-root user:



./javathreads: line 2: /home/proc_threads/tempfile: Permission denied

awk: cmd. line:1: fatal: cannot open file `/home/proc_threads/tempfile'
for reading (Permission denied)



Thanks

Jatin



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos




...and what are permissions of /home/proc_threads/tempfile? It seems,
that users can't write to it.. Try 'chmod o+w
/home/proc_threads/tempfile'



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-25-2010, 01:07 PM
James Bensley
 
Default Unable to execute a script , Permission denied

How are you trying to execute the script, "./my script" or "sh ./my_script"?

--
Regards,
James.

http://www.jamesbensley.co.cc/ - There are only 10 kinds of people in
the world, those who understand trinary, those who don't understand
trinary and those who don't understand trinary.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-25-2010, 01:14 PM
Bowie Bailey
 
Default Unable to execute a script , Permission denied

Jatin Davey wrote:
> Here is the script that i am trying to execute as a non-root user:
>
> #!/bin/sh
> ps -C java -o thcount > /home/proc_threads/tempfile
> awk ' { total += $1 } END { print total } ' /home/proc_threads/tempfile
>
> here is the output when i try to execute as a non-root user:
>
> ./javathreads: line 2: /home/proc_threads/tempfile: Permission denied
> awk: cmd. line:1: fatal: cannot open file
> `/home/proc_threads/tempfile' for reading (Permission denied)

The script is running, but the 'awk' line is failing to read
/home/proc_threads/tempfile. What are the permissions on that file and
directory?


$ ls -ld /home/proc_threads

$ ls -l /home/proc_threads/tempfile

--
Bowie
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-25-2010, 01:27 PM
Jatin Davey
 
Default Unable to execute a script , Permission denied

On 5/25/2010 6:44 PM, Bowie Bailey wrote:
> Jatin Davey wrote:
>
>> Here is the script that i am trying to execute as a non-root user:
>>
>> #!/bin/sh
>> ps -C java -o thcount> /home/proc_threads/tempfile
>> awk ' { total += $1 } END { print total } ' /home/proc_threads/tempfile
>>
>> here is the output when i try to execute as a non-root user:
>>
>> ./javathreads: line 2: /home/proc_threads/tempfile: Permission denied
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/proc_threads/tempfile' for reading (Permission denied)
>>
> The script is running, but the 'awk' line is failing to read
> /home/proc_threads/tempfile. What are the permissions on that file and
> directory?
>
>
> $ ls -ld /home/proc_threads
>
> $ ls -l /home/proc_threads/tempfile
>
>

Thanks all

I finally figured out that the tempfile that i was creating did not have
proper permissions for the script to write into. Now i have fixed it
using the chmod command and it is working fine.

Thanks
Jatin
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 05-25-2010, 01:29 PM
James Hogarth
 
Default Unable to execute a script , Permission denied

On 25 May 2010 14:14, Bowie Bailey <Bowie_Bailey@buc.com> wrote:
> Jatin Davey wrote:
>> Here is the script that i am trying to execute as a non-root user:
>>
>> #!/bin/sh
>> ps -C java -o thcount > /home/proc_threads/tempfile
>> awk ' { total += $1 } END { print total } ' /home/proc_threads/tempfile
>>
>> here is the output when i try to execute as a non-root user:
>>
>> ./javathreads: line 2: /home/proc_threads/tempfile: Permission denied
>> awk: cmd. line:1: fatal: cannot open file
>> `/home/proc_threads/tempfile' for reading (Permission denied)
>
> The script is running, but the 'awk' line is failing to read
> /home/proc_threads/tempfile. *What are the permissions on that file and
> directory?
>
>
> * *$ ls -ld /home/proc_threads
>
> * *$ ls -l /home/proc_threads/tempfile
>
> --
> Bowie
> _______________________________________________
> CentOS mailing list
> CentOS@centos.org
> http://lists.centos.org/mailman/listinfo/centos
>

Looks like it is failing before the awk...

For that script to run the directory will need to be writeable by the
user running the script...

chmod o+w /home/proc_threads will do if you don't care for security of
the file/directory... or arrange the group of the user running the
script to be able to write to the directory instead.

James
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 06:25 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org