LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

Reply
 
LinkBack Search this Thread
Old 06-24-2005, 04:56 PM   #1
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Rep: Reputation: 15
Question Access Denied when trying to log info in files w/ script


I wrote a menu script on a mandrake box and then moved it over to a RedHat box... it ran fine on the mandrake Konsole... and after some rmp files were added for the dialog command the menu comes up on the screen.... my problem is that there are 3 files (2 are temp files and one is like a log file)... in any case information is written to them all... when an option is chosen in the script it tells me that access is denied to these 3 files. I am useing the root user right now because I don't want to add the new user until I get the menu up and running correctly... The script and 3 files are currently owned by root and are in the root group.... a=rw for them and the script(script has x also) ... #!/bin/bash is at the top of the script... why can't the script write to these files.. I am a complete rookie at this but willing to learn.... Thanks for all help in advance

Last edited by bigdog0007; 06-27-2005 at 10:53 AM.
 
Old 06-24-2005, 05:04 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,527

Rep: Reputation: 147Reputation: 147
Which directory are the files in? Please check the directory permissions.
 
Old 06-24-2005, 06:44 PM   #3
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Original Poster
Rep: Reputation: 15
The Files and script are in a folder that I created in /user/share/menu/
The permissions on menu are as follows: drwxrwxrwx

the error is :

.test.sh: /usr/share/menu/menuop.tmp: Permission denied

and it does it for all 3 files

the usr and share folder only has drwxr-xr-x

do you think that is the problem?

I just tried moving it to just /menu and changing the script accordingly ... i got the same response:

./test.sh: /menu/menuop.tmp: Permission denied
 
Old 06-26-2005, 12:26 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,527

Rep: Reputation: 147Reputation: 147
Quote:
Originally posted by bigdog0007
./test.sh: /menu/menuop.tmp: Permission denied
That's incorrent for sure. You don't have /menu/menuopt.tmp. Could you copy the main part of your script (when you try to access the files)?
 
Old 06-27-2005, 10:47 AM   #5
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Original Poster
Rep: Reputation: 15
I actually have another script.... but i rewrote it to do simple things , trying to see what I did wrong... so this is the one that the error above came from .... btw I manually created the 3 files with the cat command b4 running the script. I have tried moving the files and the script around to different directories .... but I seem to still get the same error... I 90% sure that it is something that I have done wrong in ownership or security ... I just can't figure out what... from what I can tell root owns it and everyone has rw on the files and rwx on the script...Thanks for all your help ... just to reiterate ... the other script written in similar structure worked fine on a mandrake machine ... but I had a GUI on that one to manipulate security

#!/bin/bash
#
#This is just a Menu Test
#
#Menu Creation
#
dialog --backtitle "Menu" --title "Main Menu" --menu "Use the arrow keys" 15 67 3 \
EchoA "Test Echoing Hello" \
EchoB "Test Echoing Nice to See You" \
Exit "Exit Menu" \
#
#
echomenu=`/menu/echomenu.tmp`
optext=`/menu/optext.tmp`
menuop=`/menu/menuop.tmp`
#
#
opt=$?
#
#
case $echomenu in
EchoA)
date > $optext
echo "Hello" >> $optext
cat $optext >> $menuop
dialog --title "Say Hello" --backtitle "Menu" --textbox $optext 15 60;;
#
EchoB)
date > $optext
echo "Nice to see you" >> $optext
cat $optext >> $menuop
dialog --title "Say Nice to see you" --backtitle "Menu" --textbox $optext 15 60;;
#
Exit)
date > $optext
echo "Thanks for Stopping In" >> $optext
cat $optext >> $menuop
dialog --title "Have a good day" --backtitle "Menu" --textbox $optext 7 35
exit;;
esac
exit 0



btw... the error comes after the selection is made... i'm guessing when it tries to write the menu selection to the tmp file

http://www.bigdog0007.com/testsherror.JPG

Last edited by bigdog0007; 06-27-2005 at 11:12 AM.
 
Old 06-27-2005, 03:31 PM   #6
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,527

Rep: Reputation: 147Reputation: 147
Quote:
Originally posted by bigdog0007

echomenu=`menu/echomenu.tmp`
optext=`menu/optext.tmp`
menuop=`menu/menuop.tmp`
Try it this way. You may need to change them to absolute path (something like /usr/share/menu/something).
 
Old 06-28-2005, 08:56 AM   #7
bigdog0007
LQ Newbie
 
Registered: May 2005
Location: NC
Posts: 26

Original Poster
Rep: Reputation: 15
Thumbs up

OK I found the problem ... I for got to put the `cat` command in my variable lines .... so what was happening was it was writing the option that was being chosen but then it was not sending that option to the case statement...btw I noticed this when I started changing everything to absolute varibles .... I also did need to go to absolute path for some of the lines.... I probably could have taken a couple of the variables out all together but I just wanted to prove to myself that it worked ... Anyway here is the updated code that works:

#This is just a Menu Test
#
#Menu Creation
#
dialog --backtitle "Menu" --title "Main Menu" --menu "Use the arrow keys" 15 67 3 \
EchoA "Test Echoing Hello Man!" \
EchoB "Test Echoing Nice to See You" \
Exit "Exit Menu" 2>/menu/echomenu.tmp

echomenu=`cat /menu/echomenu.tmp`
optext=`cat /menu/optext.tmp`
menuop=`cat /menu/menuop.tmp`

opt=$?

case $echomenu in
EchoA)
date>/menu/optext.tmp
echo "Hello Man!">>/menu/optext.tmp
$optext>>menu/menuop.tmp
dialog --title "Say Hello Man!" --backtitle "Menu" --textbox /menu/optext.tmp 15 60;;

EchoB)
date>/menu/optext.tmp
echo "Nice to see you">>/menu/optext.tmp
$optext.tmp>>/menu/menuop.tmp
dialog --title "Say Nice to see you" --backtitle "Menu" --textbox /menu/optext.tmp 15 60;;

Exit)
date>/menu/optext.tmp
echo "Thanks for Stopping In">>/menu/optext.tmp
$optext>>menu/menuop.tmp
dialog --title "Have a good day" --backtitle "Menu" --textbox /menu/optext.tmp 7 35
exit;;

esac

./test.sh

exit 0


THANKS FOR YOUR HELP... IT HAS HELPED OUT A LOT WITH THE REAL MENU SCRIPT THAT I AM WRITING!!!

Last edited by bigdog0007; 06-28-2005 at 08:58 AM.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
access denied copying files djarmb Linux - Newbie 14 11-11-2005 02:24 PM
denied access to move files into /usr/src directory Larry O Linux - Newbie 4 01-17-2005 11:14 PM
I need a a gprs modem to send log files back from a remote location any info paulb2244 Linux - Hardware 1 06-19-2004 02:57 PM
Squid access.log files davebarnes Linux - Networking 1 10-27-2002 04:05 PM
Can log files be time stamped? (such as FTP login and transfer log files) bripage Linux - Networking 6 08-08-2002 10:55 PM


All times are GMT -5. The time now is 01:11 AM.

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