student@Ubuntu:/$ ls -l
total 80
drwxr-xr-x 1 root root 4096 May 9 2021 bin
drwxr-xr-x 2 root root 4096 Apr 24 2018 boot
drwxr-xr-x 5 root root 360 Nov 23 19:50 dev
drwxr-xr-x 1 root root 4096 Nov 23 19:50 etc
drwxr-xr-x 1 root root 4096 May 9 2021 home
drwxr-xr-x 1 root root 4096 May 9 2021 lib
drwxr-xr-x 2 root root 4096 Apr 16 2021 lib64
drwxr-xr-x 2 root root 4096 Apr 16 2021 media
drwxr-xr-x 2 root root 4096 Apr 16 2021 mnt
drwxr-xr-x 1 root root 4096 May 9 2021 opt
dr-xr-xr-x 167 root root 0 Nov 23 19:50 proc
drwx------ 1 root root 4096 May 9 2021 root
drwxr-xr-x 1 root root 4096 May 9 2021 run
drwxr-xr-x 1 root root 4096 May 9 2021 sbin
drwxr-xr-x 2 root root 4096 Apr 16 2021 srv
dr-xr-xr-x 13 root root 0 Nov 23 19:50 sys
drwxrwxrwt 1 root root 4096 Nov 23 19:52 tmp
drwxr-xr-x 1 root root 4096 Apr 16 2021 usr
drwxr-xr-x 1 root root 4096 Apr 16 2021 var
student@Ubuntu:/$ cd tmp
student@Ubuntu:/tmp$ cat /var/log/auth.log
cat: /var/log/auth.log: Permission denied
student@Ubuntu:/tmp$ cd ..
student@Ubuntu:/$ cd sys
student@Ubuntu:/sys$ cat /var/log/auth.log
cat: /var/log/auth.log: Permission denied
student@Ubuntu:/sys$ chmod 777 sys
chmod: cannot access 'sys': No such file or directory
student@Ubuntu:/sys$ cd ..
student@Ubuntu:/$ chmod 777 sys
chmod: changing permissions of 'sys': Read-only file system
student@Ubuntu:/$ chmod 777 var
chmod: changing permissions of 'var': Operation not permitted
Asked
Active
Viewed 1.7k times
-2
Michael260
- 11
- 1
- 1
- 3
-
3Don't play around with permissions of system files.Use `sudo cat /var/log/auth.log` if you want to see the content of the logfile. – mook765 Nov 23 '21 at 21:23
-
student@Ubuntu:~$ cat /var/log/auth.log cat: /var/log/auth.log: Permission denied student@Ubuntu:~$ That is why I need change permissions to be able accomplish a task. – Michael260 Nov 23 '21 at 21:30
-
... or add your user to the `adm` group, which is provided for exactly this scenario – steeldriver Nov 23 '21 at 21:31
1 Answers
3
If you want to see the content of /var/log/auth.log you just need to make use of the sudo-command:
sudo cat /var/log/auth.log
will prompt you for your password and then display the content of the file.
Don't change permissions of system files, you'd easily end up with a reinstall of your operating system.
Alternatively you could add the user to the adm-group with
sudo adduser $USER adm
Followed by logout/login, groups are applied at login time.
This will make the use of the sudo-command unnecessary.
waltinator
- 35,099
- 19
- 57
- 93
mook765
- 14,911
- 5
- 35
- 67