Score:-2

How to apply chmod 777 command to gain permissions to be able read the content of auth.log which is located under the /var/log directory

cg flag
 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
mook765 avatar
cn flag
Don'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.
cg flag
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.
hr flag
... or add your user to the `adm` group, which is provided for exactly this scenario
Score:3
cn flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.