LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 11-24-2023, 06:53 AM   #1
tuxthegreat
Member
 
Registered: Mar 2018
Distribution: Ubuntu Mate, OSX, Win10, ODROID-N2+
Posts: 180

Rep: Reputation: Disabled
Angry Guys I need your help, I can access my syslog with my normal user, permissions are messed up


I did
Code:
ls -l /var/log/syslog
and got the result
Code:
-rw-r--r-- 1 syslog adm 198407 Nov 24 13:30 /var/log/syslog
Now I know that that extra r at the end shouldn't be there, how can I fix my permissions so that only root can access my syslog? Because as of right now I can
Code:
 cat /var/log/syslog
without root password and it's driving me nuts.

My system specs are as follows. Ubutu mate 16.04 with esm updates until 2024. My kernel is
Code:
 uname -r 6.5.12-x64v1-xanmod1
 
Old 11-24-2023, 08:13 AM   #2
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 799

Rep: Reputation: 256Reputation: 256Reputation: 256
Code:
chmod 640 /var/log/syslog
Make sure whatever is rotating your logs is setting it correctly as well or it will go back to whatever it is set as.
 
1 members found this post helpful.
Old 11-24-2023, 11:05 AM   #3
tuxthegreat
Member
 
Registered: Mar 2018
Distribution: Ubuntu Mate, OSX, Win10, ODROID-N2+
Posts: 180

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by jayjwa View Post
Code:
chmod 640 /var/log/syslog
Make sure whatever is rotating your logs is setting it correctly as well or it will go back to whatever it is set as.
Hey it worked, I got permission denied. now let's hope that I didn't break syslog and the OS won't have a place to put it's syslog complaints. I am crossing my flippers.
 
Old 11-24-2023, 11:17 AM   #4
lvm_
Member
 
Registered: Jul 2020
Posts: 984

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
Quote:
Originally Posted by tuxthegreat View Post
how can I fix my permissions so that only root can access my syslog? Because as of right now I can without root password and it's driving me nuts.
Why? There is no explicit security information in syslog. If it falls into the wrong hands, the worst that can happen is that it will provide some information about the system configuration which may be helpful when probing for weaknesses and vulnerabilities but, as it is usually done by automated metasploit scanning, not by careful perusing of the logs and picking individual opportunities, your logs are useless for hackers. Don't bother. BTW the default access settings for syslog is not just root, but root and all users in the group adm.
 
1 members found this post helpful.
Old 11-24-2023, 04:49 PM   #5
tuxthegreat
Member
 
Registered: Mar 2018
Distribution: Ubuntu Mate, OSX, Win10, ODROID-N2+
Posts: 180

Original Poster
Rep: Reputation: Disabled
Wink

Quote:
Originally Posted by lvm_ View Post
Why? There is no explicit security information in syslog. If it falls into the wrong hands, the worst that can happen is that it will provide some information about the system configuration which may be helpful when probing for weaknesses and vulnerabilities but, as it is usually done by automated metasploit scanning, not by careful perusing of the logs and picking individual opportunities, your logs are useless for hackers. Don't bother. BTW the default access settings for syslog is not just root, but root and all users in the group adm.
I wasn't aware, thank you for telling me this information, it is really helpful.
 
Old 11-25-2023, 06:25 AM   #6
tuxthegreat
Member
 
Registered: Mar 2018
Distribution: Ubuntu Mate, OSX, Win10, ODROID-N2+
Posts: 180

Original Poster
Rep: Reputation: Disabled
Arrow

Quote:
Originally Posted by jayjwa View Post
Code:
chmod 640 /var/log/syslog
Make sure whatever is rotating your logs is setting it correctly as well or it will go back to whatever it is set as.
How would I go about checking my log rotating and set it correctly? Here are my /etc/logrotate.d/rsyslog config file
Code:
/etc/logrotate.d# cat rsyslog
/var/log/syslog
{
	rotate 7
        size=50M
	daily
	missingok
	notifempty
	delaycompress
	compress
	postrotate
		invoke-rc.d rsyslog rotate >/dev/null
	endscript
}

/var/log/mail.info
/var/log/mail.warn
/var/log/mail.err
/var/log/mail.log
/var/log/daemon.log
/var/log/kern.log
/var/log/auth.log
/var/log/user.log
/var/log/lpr.log
/var/log/cron.log
/var/log/rsyslog.log
/var/log/debug
/var/log/messages
{
	rotate 4
	weekly
	missingok
	notifempty
	compress
	delaycompress
	sharedscripts
	postrotate
		invoke-rc.d rsyslog rotate >/dev/null
	endscript
}
And here is my /etc/logrotate.conf file

Code:
 cat /etc/logrotate.conf
# see "man logrotate" for details
# rotate log files weekly
weekly

# use the syslog group by default, since this is the owning group
# of /var/log/syslog.
su root syslog

# keep 4 weeks worth of backlogs
rotate 4

# restrict maximum size of log files
size 250M

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
    missingok
    monthly
    create 0664 root utmp
    rotate 1
}

/var/log/btmp {
    missingok
    monthly
    create 0660 root utmp
    rotate 1
}

# system-specific logs may be configured here
Do you see anything in there that would effect my syslog from changing permission to user again after the next rotation ?

Last edited by tuxthegreat; 11-25-2023 at 06:35 AM.
 
Old 11-25-2023, 12:36 PM   #7
jayjwa
Member
 
Registered: Jul 2003
Location: NY
Distribution: Slackware, Termux
Posts: 799

Rep: Reputation: 256Reputation: 256Reputation: 256
The umask of whoever is running logrotate might set it back 644 after rotation. You could chmod in the post rotate section of the syslog stanza if that happens. That's kind of hacky, and you might want to study/learn logrotate from its manpage if you want to do more fancy things than the default for your system.
 
1 members found this post helpful.
Old 11-25-2023, 01:13 PM   #8
jmgibson1981
Senior Member
 
Registered: Jun 2015
Location: Tucson, AZ USA
Distribution: Debian
Posts: 1,151

Rep: Reputation: 393Reputation: 393Reputation: 393Reputation: 393
Are you running Ubuntu? One of the default user groups is adm. If your user is in that group then you have read permissions as you showed. To remove that just remove yourself from the group. Much better choice than messing with permissions outside of your home folder.

Code:
-rw-r--r-- 1 syslog adm 198407 Nov 24 13:30 /var/log/syslog
 
1 members found this post helpful.
Old 11-25-2023, 02:24 PM   #9
tuxthegreat
Member
 
Registered: Mar 2018
Distribution: Ubuntu Mate, OSX, Win10, ODROID-N2+
Posts: 180

Original Poster
Rep: Reputation: Disabled
Red face

Quote:
Originally Posted by jmgibson1981 View Post
Are you running Ubuntu? One of the default user groups is adm. If your user is in that group then you have read permissions as you showed. To remove that just remove yourself from the group. Much better choice than messing with permissions outside of your home folder.

Code:
-rw-r--r-- 1 syslog adm 198407 Nov 24 13:30 /var/log/syslog
Ok I looked up removing groups and here is what I got
Code:
~# groups tuxthegreat
tuxkthegreat : tuxthegreat sudo deluge
Is this the group I want to edit or is it a different group, why is deluge in that group, I will remove deluge from the group by doing
Code:
 usermod -G tuxthegreat,sudo tuxthegreat
root@tuxthegreat:~# groups tuxthegreat
tuxthegreat : tuxthegreat sudo
Now deluge is gone from the group, are there any other groups I should edit? Is there a groups -list command or something of that nature? This is very helpful as I am going to attempt to install LFS in the upcoming weeks.

Last edited by tuxthegreat; 11-25-2023 at 03:08 PM.
 
Old 11-27-2023, 11:53 PM   #10
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
You're using the word 'group' wrong there..

What you mean is 'deluge' in the list of groups your user is in.

The list of all avail groups (on a locally adminned machine) is /etc/group.

HTH
 
Old 11-28-2023, 12:24 AM   #11
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,682
Blog Entries: 19

Rep: Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492Reputation: 4492
Quote:
Originally Posted by tuxthegreat View Post
This is very helpful as I am going to attempt to install LFS in the upcoming weeks.
When you build LFS, you create a special LFS user first to do the job, and then construct a standard environment for them, precisely so that you don't carry over any weirdness from your distro's default environment.
 
1 members found this post helpful.
  


Reply

Tags
kernel, permissions, syslog, ubuntu mate



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
is it possible that normal user should not able to remove crontab which was set by superuser for this normal user? gjoshi Linux - Newbie 1 04-02-2019 12:30 AM
I need help getting syslog to log remotely, this is just the regular syslog. abefroman Linux - Software 2 06-05-2008 11:36 AM
X hangs at startup, permissions for normal user messed up. elgatofilo Slackware 5 12-20-2004 08:48 PM

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

All times are GMT -5. The time now is 06:20 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