LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Permission Denied for script accessing text file (https://www.linuxquestions.org/questions/linux-general-1/permission-denied-for-script-accessing-text-file-338061/)

lobo1 06-28-2005 12:16 PM

Permission Denied for script accessing text file
 
I have bash shell scripts running on Linux box, RedHat 9. They convert files into XML format by parsing of text files. The text files that are created on the Linux box work fine. But a different sensor creates data/text files on a Windows machine. I move the data/text file from the Windows machine to the Linux box by using a Samba share and just copy the file to the shared (Linux) drive on the Windows box. On the Linux box, my file is in the directory that I am running the scripts on. The problem is, when I run the script to use the data/text file from that originated on the Windows box, I get Permission Denied in the script error message, when it gets to the data/text file. I have tried changing permissions on the file to allow the maximum access. I have also copied the data into a file that I created on the Linux box. I keep getting permission denied. Its just a text file, can there be something inherently different in the text since it was moved from a Windows box, that Linux just cannot read? Any suggestions as to how to proceed are much appreciated.

bigfez 06-28-2005 12:32 PM

windows uses different line endings than linux, linux uses \n while windows uses \r\n
thats more likely to cause a script to blow-up than throw a permission denied error.

You said you checked and changed permissions, but have you checked ownership?

lobo1 06-28-2005 12:46 PM

The file is owned by root as are the Linux originated files which work in the script. Here is the ls -al for the data/text file ALCOGGG.TXT:

-rw-r--r-- 1 root root 112 Jun 27 15:56 ALCOGGG.TXT

I am running the scripts as root as I am working on this problem. Here is the first part of the script:

#Cut the observation data from the text file.
#
FILENAME=/home/aprsd2/ALCOGGG.TXT

if $FILENAME
then


It doesn't get past this line and this is the error message:

./xmlconvGRB5: line 16: /home/aprsd2/ALCOGGG.TXT: Permission denied


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