LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   permission error on /var/log/messages (https://www.linuxquestions.org/questions/linux-newbie-8/permission-error-on-var-log-messages-855289/)

hks1233 01-10-2011 01:23 AM

permission error on /var/log/messages
 
Hi

I cannot make any permission change on /var/log/messages.Currently the permission looks like

?r---ws--t 58243 115 59053 1358438049 Jan 10 10:55 /var/log/messages


How can i change the permission to root. Already chown failed giving a permission failed error.

EricTRA 01-10-2011 01:46 AM

Hello,

Looks like you have the 'sticky bit' set on your messages file. That means that only the owner and users with write permissions can modify that file. What also strikes me as strange is that you have numerical IDs instead of the regular username:group combination. Did you by any change get the permissions with ls -ln. Try ls -l to see the username of the owner. Try as root to remove the sticky bit with:
Code:

chmod -t /var/log/messages
Kind regards,

Eric

hks1233 01-10-2011 02:23 AM

Hi

Output for ls -ln
?r---ws--t 58243 115 59053 1358438049 Jan 10 10:55 messages

Output for ls -l
?r---ws--t 58243 115 59053 1358438049 Jan 10 10:55 messages

Output for chmod -t /var/log/messages
chmod: changing permissions of `/var/log/messages': Operation not permitted

No idea why this happens

Waiting for a help

EricTRA 01-10-2011 02:27 AM

Hi,

As what user did you try the chmod command? Can you execute the following and post the output:
Code:

stat /var/log/messages
Kind regards,

Eric

hks1233 01-10-2011 02:40 AM

Hi

as root

Output for stat /var/log/messages

File: `/var/log/messages'
Size: 1358438049 Blocks: 4022424563 IO Block: 4096 weird file
Device: 803h/2051d Inode: 6968287 Links: 58243
Access: (3431/?r---ws--t) Uid: ( 115/ UNKNOWN) Gid: (59053/ UNKNOWN)
Access: 2011-01-10 10:55:39.000000000 +0530
Modify: 2011-01-10 10:55:39.000000000 +0530
Change: 2011-01-10 10:55:39.000000000 +0530

EricTRA 01-10-2011 03:16 AM

Hi,

Something is terribly wrong with your system in my opinion. Stat only shows the numerical ID. Can you execute the following as root:
Code:

id
and post the output. That should show some information about group membership and account information. Also the following:
Code:

cat /etc/passwd | grep 115
cat /etc/group | grep 59053

To see if there's a reference in your account files.

Kind regards,

Eric

hks1233 01-10-2011 03:29 AM

Hi

Output for id

uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)

No result for
cat /etc/passwd | grep 115
cat /etc/group | grep 59053

EricTRA 01-10-2011 03:36 AM

Hello,

What are the permissions on your /var/log folder:
Code:

ls -l /var | grep log
Kind regards,

Eric

Sayan Acharjee 01-10-2011 03:46 AM

Quote:

Originally Posted by hks1233 (Post 4218977)
Hi

I cannot make any permission change on /var/log/messages.Currently the permission looks like

?r---ws--t 58243 115 59053 1358438049 Jan 10 10:55 /var/log/messages


How can i change the permission to root. Already chown failed giving a permission failed error.

I think its attribute has been changed, try running the following command:

Code:

#chattr -i /var/log/messages
Now try changing the permissions again, good luck.

EricTRA 01-10-2011 03:59 AM

Quote:

Originally Posted by sayan_acharjee (Post 4219092)
I think its attribute has been changed, try running the following command:

Code:

#chattr -i /var/log/messages
Now try changing the permissions again, good luck.

Hi,

You might have a good point here. Didn't think of that one yet (Monday, Monday, ...). List the attributes using :
Code:

lsattr /var/log/messages
Kind regards,

Eric

hks1233 01-10-2011 03:59 AM

Hi
Please have a look

Quote:

[root@xxx log]# ls -l /var | grep log
drwxr-xr-x 2 root root 4096 Nov 12 00:00 backuplog
drwxr-xr-x 15 root root 4096 Jan 10 10:12 log
[root@xxx log]# chattr -i /var/log/messages
[root@xxx log]# ls -l /var/log/messages
?r---ws--t 58243 115 59053 1358438049 Jan 10 10:55 /var/log/messages
[root@xxx log]# chown root.root messages
chown: changing ownership of `messages': Operation not permitted
[root@xxx log]# lsattr /var/log/messages
lsattr: Inappropriate ioctl for device While reading flags on /var/log/messages

Sayan Acharjee 01-10-2011 04:03 AM

Quote:

Originally Posted by hks1233 (Post 4219107)
[root@xxx log]# chown root.root messages
chown: changing ownership of `messages': Operation not permitted

The command you are executing is wrong.
It should be,

Code:

# chown root:root /var/log/messages
not

Code:

chown root.root messages

EricTRA 01-10-2011 04:08 AM

Hello,

Try:
Code:

chattr -ais /var/log/messages
and try again. Also, do you have SELinux enabled?

Kind regards,

Eric

hks1233 01-10-2011 04:12 AM

Hi

Output
Quote:

[root@xxx log]# chattr -ais /var/log/messages
[root@xxx log]# chown root:root /var/log/messages
chown: changing ownership of `/var/log/messages': Operation not permitted

Sayan Acharjee 01-10-2011 04:26 AM

Quote:

Originally Posted by hks1233 (Post 4219116)
Hi

Output

Hi, can you try these again and post the outputs?

Code:

#chattr -i /var/log/messeages
and then,

Code:

#echo $?


All times are GMT -5. The time now is 09:24 PM.