Why cant i view a text file in browser?

General support questions
Post Reply
PresFox
Posts: 11
Joined: 2018/05/21 08:55:26

Why cant i view a text file in browser?

Post by PresFox » 2018/06/08 20:26:02

Hello,

I have a text file on my domain that i want to view in browser,

Permissions and ownership are set like other files in the directory, but i still get a 403 error, what is wrong?

Code: Select all

 ls -l
total 5960
-rw-r--r--  1 root root    1676 Jun  8 16:23 config.txt
-rw-r--r--  1 root root  595183 Jun  8 16:24 error.log
drwxrwxrwx 17 root root    4096 Jun  6 13:17 hook
-rw-r--r--  1 root root      12 Jun  6 11:40 index.html
-rw-r--r--  1 root root 5483012 Jun  8 16:24 requests.log

gjaltemba
Posts: 49
Joined: 2016/11/29 15:23:25

Re: Why cant i view a text file in browser?

Post by gjaltemba » 2018/06/09 00:57:16

What is the output of

ls -lZ
sestatus

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: Why cant i view a text file in browser?

Post by desertcat » 2018/06/09 05:15:56

PresFox wrote:
2018/06/08 20:26:02
Hello,

I have a text file on my domain that i want to view in browser,

Permissions and ownership are set like other files in the directory, but i still get a 403 error, what is wrong?

Code: Select all

 ls -l
total 5960
-rw-r--r--  1 root root    1676 Jun  8 16:23 config.txt
-rw-r--r--  1 root root  595183 Jun  8 16:24 error.log
drwxrwxrwx 17 root root    4096 Jun  6 13:17 hook
-rw-r--r--  1 root root      12 Jun  6 11:40 index.html
-rw-r--r--  1 root root 5483012 Jun  8 16:24 requests.log
There are a couple ways to view a simple text file. One way is to open in a simple text editor such as vi, vim, or sublime, but my favourite way is in Midnight Commander (mc). You can not only read text files, but also edit them if you need to. To read the contents of any file -- not just text -- locate the file and Press F3; to Edit any text file Press F4; to Save any changes to the file Press F2. mc is a common utility and can easily installed: yum install mc. To start type "mc" in any terminal or konsole.

PresFox
Posts: 11
Joined: 2018/05/21 08:55:26

Re: Why cant i view a text file in browser?

Post by PresFox » 2018/06/09 06:17:16

i dont want to edit the file,, i want to show it in the browser

ls -lZ

Code: Select all

[root@mnr1 hook]# ls -lZ
-rw-r--r-- root root ?                                config.txt
-rw-r--r-- root root ?                                error.log
drwxrwxrwx root root ?                                hook
-rw-r--r-- root root ?                                index.html
-rw-r--r-- root root ?                                requests.log
[root@mnr1 hook]#
Selinux:

Code: Select all

[root@mnr1 hook]# sestatus
SELinux status:                 disabled

scottro
Forum Moderator
Posts: 2556
Joined: 2007/09/03 21:18:09
Location: NYC
Contact:

Re: Why cant i view a text file in browser?

Post by scottro » 2018/06/09 06:43:05

I'm assuming you can view all the other files listed in the browser, correct? (Including the log ones). Which browser? Is this something where you want the text file to be available on the Internet or something where you're just using file:///home/mydirectory/myfile.txt

I've never run into this, so don't have any other userful hints, I fear. Is there anything useful in /var/log/httpd/access or error_log?
New users should check the FAQ and Read Me First pages

PresFox
Posts: 11
Joined: 2018/05/21 08:55:26

Re: Why cant i view a text file in browser?

Post by PresFox » 2018/06/09 09:25:23

i just want to open it in the browser, its a config file for a piece of software.

The other files are accessible fine, no problems at all there. What i do notice is that when i change the CHMOD to 755, centos seems to think its an executable file.

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Why cant i view a text file in browser?

Post by hunter86_bg » 2018/06/09 09:52:47

In order to resolve this , let's get an aanswer to the following:
1. Hostname of the machine that contains your configuration file.
2. Full path to file
3. Hostname of the machine that the browser is started from
4. Url passed to the browser

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: Why cant i view a text file in browser?

Post by desertcat » 2018/06/09 21:57:42

PresFox wrote:
2018/06/09 09:25:23
i just want to open it in the browser, its a config file for a piece of software.

The other files are accessible fine, no problems at all there. What i do notice is that when i change the CHMOD to 755, centos seems to think its an executable file.
chmod 755 means that it *will* be and executable file. Using 755 you are specifying:

7 --> u=rwx (4+2+1 for owner)
5 --> g=rx (4+1 for group)
5 --> o=rx (4+1 for others)

What am I missing here??

And what is so hard about reading a text file in a terminal?? mc is fast and easy to use, unless you happen to like using a text editor like vi, vim, or sublime.

And when you say "browser" are you talking about a FILE browser, or an EMAIL Browser such as Outlook, GMail, etc.?

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: Why cant i view a text file in browser?

Post by desertcat » 2018/06/09 22:14:41

PresFox wrote:
2018/06/09 09:25:23
i just want to open it in the browser, its a config file for a piece of software.

The other files are accessible fine, no problems at all there. What i do notice is that when i change the CHMOD to 755, centos seems to think its an executable file.
chmod 755 means that it *will* be and executable file. Using 755 you are specifying:

7 --> u=rwx (4+2+1 for owner)
5 --> g=rx (4+1 for group)
5 --> o=rx (4+1 for others)

What am I missing here??

And what is so hard about reading a text file in a terminal?? mc is fast and easy to use, unless you happen to like using a text editor like vi, vim, or sublime.

And when you say "browser" are you talking about a FILE browser, or an EMAIL Browser such as Firefox, Google Chrome, Outlook, GMail, etc.?

Post Reply