LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-12-2015, 05:20 AM   #1
jwonnacott
LQ Newbie
 
Registered: Jun 2013
Posts: 20

Rep: Reputation: Disabled
Getting "permission denied" as root


I have a debian server (wheezy) which is running an apache2 server and a squid proxy.
Today I tried to view squid log files (as root) and got "permission denied" on trying to enter the /var/log/squid directory.
I then tried sylog and got the same result.
Trying to enter the /root directory or any other directory owned by root with drwx------ permissions gives the same result too.
All was OK on Friday when I last viewed the squid logs.
Any suggestions as to what the problem may be?

Thanks,
James
 
Old 10-12-2015, 05:24 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 20,772

Rep: Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057
the usual reason is you tried it as non-root user.
Otherwise please show us exactly what have you tried and explain what have you modified since Friday.
 
Old 10-12-2015, 05:30 AM   #3
jwonnacott
LQ Newbie
 
Registered: Jun 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
As stated I'm attempting this as root. I have changed nothing (or even logged in) since Friday.
 
Old 10-12-2015, 05:38 AM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,465

Rep: Reputation: Disabled
Can you post the output of this command (run as root):
Code:
ls -l /var/log/<squid directory>
jdk
 
Old 10-12-2015, 05:42 AM   #5
jwonnacott
LQ Newbie
 
Registered: Jun 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
login as: j1
j1@192.168.10.93's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have mail.
Last login: Mon Oct 12 09:43:57 2015 from j1office.xxxxxxxxxxxxxx.xxx
j1@squid2:~$ su
Password:
root@squid2:/var/www/wordpress$ cd /root
bash: cd: /root: Permission denied
root@squid2:/var/www/wordpress$ cat /var/log/syslog
cat: /var/log/syslog: Permission denied
root@squid2:/var/www/wordpress$ cd /var/log
root@squid2:/var/log$ ls -l
total 1188
-rw-r--r-- 1 root root 0 Jul 24 06:25 alternatives.log
-rw-r--r-- 1 root root 2709 Jul 23 13:34 alternatives.log.1
-rw-r--r-- 1 root root 231 Oct 16 2014 alternatives.log.2.gz
-rw-r--r-- 1 root root 2149 Oct 16 2013 alternatives.log.3.gz
drwxr-x--- 8 root adm 4096 Oct 11 06:25 apache2
drwxr-xr-x 2 root root 4096 Jul 24 06:25 apt
-rw-r--r-- 1 root root 0 Nov 1 2013 aptitude
-rw-r--r-- 1 root root 209 Oct 14 2013 aptitude.1.gz
-rw-r----- 1 root adm 25252 Oct 12 11:37 auth.log
-rw-r----- 1 root adm 131427 Oct 11 06:25 auth.log.1
-rw-r----- 1 root adm 8638 Oct 4 06:25 auth.log.2.gz
-rw-r----- 1 root adm 8740 Sep 27 06:25 auth.log.3.gz
-rw-r----- 1 root adm 8759 Sep 20 06:25 auth.log.4.gz
-rw-rw---- 1 root utmp 0 Oct 1 06:25 btmp
-rw-rw---- 1 root utmp 0 Sep 1 06:25 btmp.1
drwxr-xr-x 2 clamav clamav 4096 Oct 11 06:25 clamav
-rw-r----- 1 root adm 5012 Oct 12 09:25 daemon.log
-rw-r----- 1 root adm 5103 Sep 2 07:07 daemon.log.1
-rw-r----- 1 root adm 1432 Aug 25 07:24 daemon.log.2.gz
-rw-r----- 1 root adm 1469 Aug 10 10:10 daemon.log.3.gz
-rw-r----- 1 root adm 2569 Jul 23 13:42 daemon.log.4.gz
drwxr-xr-x 2 dansguardian dansguardian 4096 Oct 12 06:25 dansguardian
drwxr-xr-x 2 root root 4096 Oct 15 2013 dbconfig-common
-rw-r----- 1 root adm 28154 Oct 12 09:25 debug
-rw-r----- 1 root adm 167 Oct 5 14:48 debug.1
-rw-r----- 1 root adm 151 Sep 26 18:24 debug.2.gz
-rw-r----- 1 root adm 143 Sep 23 11:08 debug.3.gz
-rw-r----- 1 root adm 4268 Sep 2 07:07 debug.4.gz
-rw-r----- 1 root adm 51699 Oct 12 09:25 dmesg
-rw-r----- 1 root adm 51841 Sep 2 07:07 dmesg.0
-rw-r----- 1 root adm 12789 Aug 25 07:23 dmesg.1.gz
-rw-r----- 1 root adm 12937 Aug 10 10:10 dmesg.2.gz
-rw-r----- 1 root adm 12728 Jul 23 13:41 dmesg.3.gz
-rw-r----- 1 root adm 13805 Jul 23 09:30 dmesg.4.gz
-rw-r--r-- 1 root root 0 Jul 24 06:25 dpkg.log
-rw-r--r-- 1 root root 39091 Jul 23 13:35 dpkg.log.1
-rw-r--r-- 1 root root 212 Nov 5 2014 dpkg.log.2.gz
-rw-r--r-- 1 root root 921 Oct 16 2014 dpkg.log.3.gz
-rw-r--r-- 1 root root 214 Oct 15 2014 dpkg.log.4.gz
-rw-r--r-- 1 root root 1303 Nov 27 2013 dpkg.log.5.gz
-rw-r--r-- 1 root root 21039 Oct 16 2013 dpkg.log.6.gz
drwxr-s--- 2 Debian-exim adm 4096 Nov 28 2013 exim4
-rw-r--r-- 1 root root 323904 Nov 27 2013 faillog
drwxr-xr-x 2 root root 4096 Oct 14 2013 fsck
drwxr-xr-x 3 root root 4096 Oct 14 2013 installer
-rw-r----- 1 root adm 77612 Oct 12 09:25 kern.log
-rw-r----- 1 root adm 126 Oct 7 14:39 kern.log.1
-rw-r----- 1 root adm 149 Oct 5 14:48 kern.log.2.gz
-rw-r----- 1 root adm 151 Sep 26 18:24 kern.log.3.gz
-rw-r----- 1 root adm 143 Sep 23 11:08 kern.log.4.gz
-rw-rw-r-- 1 root utmp 2955624 Oct 12 11:37 lastlog
-rw-r----- 1 root adm 0 Oct 14 2013 lpr.log
-rw-r----- 1 root adm 0 Oct 14 2013 mail.err
-rw-r----- 1 root adm 2186 Oct 12 11:12 mail.info
-rw-r----- 1 root adm 14801 Oct 9 19:05 mail.info.1
-rw-r----- 1 root adm 3591 Oct 3 22:40 mail.info.2.gz
-rw-r----- 1 root adm 3151 Sep 25 22:38 mail.info.3.gz
-rw-r----- 1 root adm 2745 Sep 19 21:22 mail.info.4.gz
-rw-r----- 1 root adm 2186 Oct 12 11:12 mail.log
-rw-r----- 1 root adm 14801 Oct 9 19:05 mail.log.1
-rw-r----- 1 root adm 3591 Oct 3 22:40 mail.log.2.gz
-rw-r----- 1 root adm 3151 Sep 25 22:38 mail.log.3.gz
-rw-r----- 1 root adm 2745 Sep 19 21:22 mail.log.4.gz
-rw-r----- 1 root adm 0 Oct 14 2013 mail.warn
-rw-r----- 1 root adm 50202 Oct 12 09:25 messages
-rw-r----- 1 root adm 2699 Oct 11 06:25 messages.1
-rw-r----- 1 root adm 335 Oct 4 06:25 messages.2.gz
-rw-r----- 1 root adm 424 Sep 27 06:25 messages.3.gz
-rw-r----- 1 root adm 407 Sep 20 06:25 messages.4.gz
drwxr-s--- 2 mysql adm 4096 Oct 15 2013 mysql
-rw-r----- 1 mysql adm 0 Oct 15 2013 mysql.err
-rw-r----- 1 mysql adm 0 Oct 12 06:25 mysql.log
-rw-r----- 1 mysql adm 20 Oct 11 06:25 mysql.log.1.gz
-rw-r----- 1 mysql adm 20 Oct 10 06:25 mysql.log.2.gz
-rw-r----- 1 mysql adm 20 Oct 9 06:25 mysql.log.3.gz
-rw-r----- 1 mysql adm 20 Oct 8 06:25 mysql.log.4.gz
-rw-r----- 1 mysql adm 20 Oct 7 06:25 mysql.log.5.gz
-rw-r----- 1 mysql adm 20 Oct 6 06:25 mysql.log.6.gz
-rw-r----- 1 mysql adm 20 Oct 5 06:25 mysql.log.7.gz
drwxr-xr-x 2 root root 4096 Oct 14 2013 news
drwxr-xr-x 2 ntp ntp 4096 May 12 2012 ntpstats
-rw-r--r-- 1 root root 21374 Oct 9 06:25 popularity-contest
-rw-r--r-- 1 root root 21036 Oct 2 06:25 popularity-contest.0
-rw-r--r-- 1 root root 6202 Sep 25 06:25 popularity-contest.1.gz
-rw-r--r-- 1 root root 6194 Sep 18 06:25 popularity-contest.2.gz
-rw-r--r-- 1 root root 6174 Sep 11 06:25 popularity-contest.3.gz
-rw-r--r-- 1 root root 6178 Sep 4 06:25 popularity-contest.4.gz
-rw-r--r-- 1 root root 6222 Aug 28 06:25 popularity-contest.5.gz
-rw-r--r-- 1 root root 6202 Aug 21 06:25 popularity-contest.6.gz
drwxr-x--- 3 root adm 20480 Oct 11 06:25 samba
drwxr-x--- 2 proxy proxy 4096 Oct 12 06:25 squid
-rw-r----- 1 root adm 88566 Oct 12 11:17 syslog
-rw-r----- 1 root adm 17441 Oct 12 06:25 syslog.1
-rw-r----- 1 root adm 1096 Oct 11 06:25 syslog.2.gz
-rw-r----- 1 root adm 1787 Oct 10 06:25 syslog.3.gz
-rw-r----- 1 root adm 1957 Oct 9 06:25 syslog.4.gz
-rw-r----- 1 root adm 2053 Oct 8 06:25 syslog.5.gz
-rw-r----- 1 root adm 1975 Oct 7 06:25 syslog.6.gz
-rw-r----- 1 root adm 1823 Oct 6 06:25 syslog.7.gz
-rw-r----- 1 root adm 615 Oct 12 09:25 user.log
-rw-r----- 1 root adm 2708 Oct 10 06:25 user.log.1
-rw-r----- 1 root adm 216 Oct 3 06:25 user.log.2.gz
-rw-r----- 1 root adm 369 Sep 26 06:25 user.log.3.gz
-rw-r----- 1 root adm 203 Sep 19 06:25 user.log.4.gz
-rw-r----- 1 root adm 132 Oct 12 04:48 vsftpd.log
-rw-r----- 1 root adm 1435 Oct 10 18:00 vsftpd.log.1
-rw-r----- 1 root adm 67 Sep 28 14:29 vsftpd.log.2
-rw-r----- 1 root adm 618 Sep 27 00:19 vsftpd.log.3
-rw-r----- 1 root adm 197 Sep 18 05:16 vsftpd.log.4
-rw-rw-r-- 1 root utmp 8064 Oct 12 11:37 wtmp
-rw-rw-r-- 1 root utmp 4608 Sep 15 14:23 wtmp.1
root@squid2:/var/log$ cd squid
bash: cd: squid: Permission denied
root@squid2:/var/log$ cd samba
bash: cd: samba: Permission denied
root@squid2:/var/log$
 
Old 10-12-2015, 05:44 AM   #6
jwonnacott
LQ Newbie
 
Registered: Jun 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
root@squid2:/var/log$ ls -l /var/log/squid
ls: cannot open directory /var/log/squid: Permission denied
root@squid2:/var/log$
 
Old 10-12-2015, 05:46 AM   #7
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
This is odd. A few things I would try:
How do you become root - by logging in as root, or by running "su"? Do both methods work?
Apart from entering directories, are there other root-only activities you can't do, such as useradd?
Have you run "id" to check if you are really root and have UID 0?
What if you create a directory as root, can you cd into it? And after chmod 700?
What if you boot into single-user mode?
 
Old 10-12-2015, 05:49 AM   #8
jwonnacott
LQ Newbie
 
Registered: Jun 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
That's interesting..........

root@squid2:/var/log$ id
uid=1079(root) gid=65534(nogroup) groups=65534(nogroup)
root@squid2:/var/log$
 
Old 10-12-2015, 05:49 AM   #9
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 20,772

Rep: Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057
yes, try id to check "yourself" and probably go into /tmp, create some files and check permissions on that. Is selinux enabled?
 
Old 10-12-2015, 05:50 AM   #10
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 20,772

Rep: Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057Reputation: 7057
grep :0: /etc/passwd
 
Old 10-12-2015, 05:51 AM   #11
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by jwonnacott View Post
That's interesting..........

root@squid2:/var/log$ id
uid=1079(root) gid=65534(nogroup) groups=65534(nogroup)
root@squid2:/var/log$
Next test: more /etc/passwd.
 
Old 10-12-2015, 05:52 AM   #12
jwonnacott
LQ Newbie
 
Registered: Jun 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
Not familiar with selinux so probably not.

---------- Post added 10-12-15 at 11:52 AM ----------

root@squid2:/var/log$ more /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13roxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www/wordpress:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
Debian-exim:x:101:103::/var/spool/exim4:/bin/false
statd:x:102:65534::/var/lib/nfs:/bin/false
sshd:x:103:65534::/var/run/sshd:/usr/sbin/nologin
j1:x:1000:1000:j1,,,:/var/www/wordpress:/bin/bash
clamav:x:104:106::/var/lib/clamav:/bin/false
dansguardian:x:105:107ansGuardian User,,,:/var/log/dansguardian:/bin/sh
mysql:x:106:108:MySQL Server,,,:/nonexistent:/bin/false
ntp:x:107:110::/home/ntp:/bin/false
messagebus:x:108:112::/var/run/dbus:/bin/false
avahi:x:109:113:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
ftp:x:110:115:ftp daemon,,,:/srv/ftp:/bin/false
web:x:10121:33::/home/web:/bin/sh
postfix:x:111:116::/var/spool/postfix:/bin/false
root@squid2:/var/log$
 
Old 10-12-2015, 05:54 AM   #13
jwonnacott
LQ Newbie
 
Registered: Jun 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
root@squid2:/var/log$ grep :0: /etc/passwd
root:x:0:0:root:/root:/bin/bash
 
Old 10-12-2015, 05:57 AM   #14
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
Quote:
Originally Posted by jwonnacott View Post
Not familiar with selinux so probably not.

---------- Post added 10-12-15 at 11:52 AM ----------

root@squid2:/var/log$ more /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
So, su is playing tricks. Try type su. Try sudo, and if /etc/sudoers is not set up, boot into single user mode and set it up. Reinstall su.
 
Old 10-12-2015, 06:01 AM   #15
jwonnacott
LQ Newbie
 
Registered: Jun 2013
Posts: 20

Original Poster
Rep: Reputation: Disabled
It does the same if I log in directly as root

login as: root
root@192.168.10.93's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon Oct 12 09:26:53 2015 from j1office.callington-comm.cornwall.sch.uk
Could not chdir to home directory /home/CSE/root: No such file or directory
root@squid2:/$ id
uid=1079(root) gid=65534(nogroup) groups=65534(nogroup)
root@squid2:/$
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Logging in as root get "/bin/bash: Permission denied" MikeyCarter Linux - Software 19 10-25-2021 11:02 AM
[SOLVED] 'sudo chown root file.txt' is inconsistent in leading to a "permission denied" output charlemagne-is-my-son Linux - Newbie 1 11-09-2014 08:47 AM
Permission Denied when trying as "root" to edit xorg.conf d3g@ Linux - Newbie 4 09-07-2006 05:19 PM
Only root hears sounds, alsa gives "permission denied" Baix Linux - General 4 07-02-2005 01:30 PM
ls in /tmp produces "permission denied" even as root kpfeiffer Linux - Newbie 5 10-06-2002 12:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:37 PM.

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