LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
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
  Search this Thread
Old 03-05-2020, 10:48 AM   #1
seog
Member
 
Registered: Jun 2012
Posts: 74

Rep: Reputation: Disabled
root gets 'permissions denied'


5 years ago the like thread was marked as solved yet can't help me now.
after my desk top switched off on his own I decided to find out what 'syslog' was about maybe it can tell me why it happened.
Code:
root@debian:~# /var/log/syslog
bash: /var/log/syslog: Permission denied
root@debian:~# id
uid=0(root) gid=0(root) groups=0(root)
root@debian:~# grep :0: /etc/passwd
root:x:0:0:root:/root:/bin/bash
oops!
Code:
root@debian:~# whoami
root
root@debian:~# /var/log/syslog
bash: /var/log/syslog: Permission denied
damn!
it's time to consult clever people and here am I. help, please!
 
Old 03-05-2020, 10:52 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,483

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Quote:
Originally Posted by seog View Post
Code:
root@debian:~# /var/log/syslog
bash: /var/log/syslog: Permission denied
damn!
it's time to consult clever people and here am I. help, please!
Why are you trying to execute /var/log/syslog?
 
1 members found this post helpful.
Old 03-05-2020, 11:45 AM   #3
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,658
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
If you want to read any kind of log, you must pass it to a command for reading text. The ones most often used for this purpose are more and less. I prefer less because it allows you to go backwards as well as forwards.

If you just type "/var/log", the shell will think you want to execute this file as a program. It will try to do that and will fail because text files are not programs and don't have the execute bit set. Not even root can turn a text file into an executable program!
 
3 members found this post helpful.
Old 03-05-2020, 11:50 AM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,737

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
Quote:
Originally Posted by hazel View Post
If you want to read any kind of log, you must pass it to a command for reading text. The ones most often used for this purpose are more and less. I prefer less because it allows you to go backwards as well as forwards.
Hmmm. In more, typing a 'b' pages backwards (and '/' can be used to enter a search term, but that only searches forwards)
At least, that's how it works for me.
 
2 members found this post helpful.
Old 03-05-2020, 11:54 AM   #5
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,658
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Quote:
Originally Posted by scasey View Post
Hmmm. In more, typing a 'b' pages backwards (and '/' can be used to enter a search term, but that only searches forwards)
At least, that's how it works for me.
Amazing! You learn something every day. I've been using Linux for 20 years now and I didn't know you could go backwards in more. Maybe I ought to read the man page
 
2 members found this post helpful.
Old 03-05-2020, 01:01 PM   #6
ehartman
Senior Member
 
Registered: Jul 2007
Location: Delft, The Netherlands
Distribution: Slackware
Posts: 1,674

Rep: Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888Reputation: 888
Quote:
Originally Posted by scasey View Post
Hmmm. In more, typing a 'b' pages backwards
That, of course, depends on which more your distro/system has installed.
The original Unix (BSD) more could only go forward (show "more" of the file).
That's why the less and most commands were written.

From the man page for the more from "util-linux" (a GNU package):
Quote:
This version is especially primitive. Users should realize that less(1) provides more(1) emulation plus extensive enhancements.
This version does provides the 'b' or 'ctrl-B' commands, though.

Last edited by ehartman; 03-05-2020 at 01:51 PM. Reason: show control B alternative
 
Old 03-05-2020, 11:40 PM   #7
seog
Member
 
Registered: Jun 2012
Posts: 74

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TenTenths View Post
Why are you trying to execute /var/log/syslog?
dear TenTenth, as I mentioned in the original post the desk top started to switch off when I don't ask it for it.

yours`
sehrguey
 
Old 03-05-2020, 11:55 PM   #8
seog
Member
 
Registered: Jun 2012
Posts: 74

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by hazel View Post
If you want to read any kind of log, you must pass it to a command for reading text. The ones most often used for this purpose are more and less. I prefer less because it allows you to go backwards as well as forwards.

If you just type "/var/log", the shell will think you want to execute this file as a program. It will try to do that and will fail because text files are not programs and don't have the execute bit set. Not even root can turn a text file into an executable program!
dear hazel
it was the first time ever I tried to look so deep under the hood and a couple of blogs/tutorials never mentioned '/var/log'
to be used as argument to 'less' or 'more' I wasn't overly tired and emotional to miss such a point.
Anyway, the problem mentioned in the thread heading is solved and you're my hero today.
yours`
sehrguey
 
1 members found this post helpful.
Old 03-05-2020, 11:56 PM   #9
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,737

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
seog, I'm sorry we haven't made this clear...
To see what's in /var/log/syslog, you need to
Code:
more /var/log/syslog
#or
less /var/log/syslog
Let us know what you see there about your "desktop switching off"
 
1 members found this post helpful.
Old 03-06-2020, 11:53 PM   #10
seog
Member
 
Registered: Jun 2012
Posts: 74

Original Poster
Rep: Reputation: Disabled
Unhappy

Quote:
Originally Posted by scasey View Post
seog, I'm sorry we haven't made this clear...
To see what's in /var/log/syslog, you need to
Code:
more /var/log/syslog
#or
less /var/log/syslog
Let us know what you see there about your "desktop switching off"
dear scasey,
the answers to this thread participants made me think
Code:
less /var/log/syslog
was more preferable.
With the 'switching off' being somewhat off the subject I marked the thread as solved.
Now, by 'switching off' I mean being thrown out of the current session or even sudden complete inexplicable power off of the desk top that sometimes happens and exasperates me. Sadly, /var/log/syslog didn't make me any wiser, I fell into an ocean of messages I couldn't understand.
Thank you for asking.
yours`
sehrguey
 
1 members found this post helpful.
Old 03-07-2020, 08:36 AM   #11
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,658
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Quote:
Originally Posted by seog View Post
Sadly, /var/log/syslog didn't make me any wiser, I fell into an ocean of messages I couldn't understand.
If syslog does contain any useful information (and that is by no means certain; it's just the obvious place to start looking), then it will be at the end of the session that crashed. So when you next boot, look for the first entry that contains the current date and time. You can do that within either more or less by entering a / and then the string you are looking for. For example /Mar 7 14:03. Note the spacing: the day of the month occupies two columns. The immediately preceding lines will be the end of the last session. Possibly those lines will be of some use.

Depending on your distro, /var/log/ may also contain a separate kernel log (often called kern.log) and/or a combined messages file. All of these can be quickly checked in the same way. Look for messages that are actually flagged up as errors or warnings.

Last edited by hazel; 03-07-2020 at 08:38 AM.
 
3 members found this post helpful.
Old 03-07-2020, 01:34 PM   #12
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,737

Rep: Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213Reputation: 2213
To add to what hazel said: When I'm looking to troubleshoot something, I often do an
Code:
ls -ltr /var/log
to identify which log file(s) was last written to right after the problem occurred.
 
2 members found this post helpful.
Old 03-07-2020, 11:25 PM   #13
seog
Member
 
Registered: Jun 2012
Posts: 74

Original Poster
Rep: Reputation: Disabled
dear hazel and scasey,
thank you ever so much for the tools enabling me to start a threat with a more appropriate subject headline.
yours`
sehrguey
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Root gets permission denied on rw local filesystem sfc Linux - Software 0 02-17-2006 11:17 AM
root gets 'Permission denied' to directory mikemrh9 Linux - Security 2 11-18-2005 04:15 AM
whatever a non-root user does, he gets 'permission denied'. boazg Linux - Software 2 08-05-2005 08:17 AM
root gets permission denied Nightfrost Debian 22 11-21-2004 05:19 AM
Gnome: root gets v2.6 but user gets v2.4 alexc Linux - Newbie 4 04-21-2004 12:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration