List files a user can see names of and contents #42

Open
opened 2024-11-08 01:04:51 +01:00 by Benjamin_Loison · 7 comments

I already did it in the past if I remember correctly.

Related to #41.

I already did it in the past if I remember correctly. Related to #41.
Author
Owner
tree /var/www/
Output:
/var/www/  [error opening dir]

0 directories, 1 file
```bash tree /var/www/ ``` <details> <summary>Output:</summary> ``` /var/www/ [error opening dir] 0 directories, 1 file ``` </details>
Author
Owner
tree /var/spool/cron/
Output:
/var/spool/cron/
├── atjobs  [error opening dir]
├── atspool  [error opening dir]
└── crontabs  [error opening dir]

4 directories, 0 files
```bash tree /var/spool/cron/ ``` <details> <summary>Output:</summary> ``` /var/spool/cron/ ├── atjobs [error opening dir] ├── atspool [error opening dir] └── crontabs [error opening dir] 4 directories, 0 files ``` </details>
Author
Owner
ls /var/log/
Output:
alternatives.log        apt                    cron.log.4.gz    dpkg.log.7.gz   letsencrypt    syslog         xrdp.log.1.gz
alternatives.log.1      auth.log               daemon.log       dpkg.log.8.gz   mail.err       syslog.1       xrdp.log.2.gz
alternatives.log.10.gz  auth.log.1             dbconfig-common  dpkg.log.9.gz   mail.info      syslog.2.gz    xrdp.log.3.gz
alternatives.log.11.gz  auth.log.2.gz          debug            faillog         mail.log       syslog.3.gz    xrdp.log.4.gz
alternatives.log.12.gz  auth.log.3.gz          dpkg.log         fontconfig.log  mail.log.1     syslog.4.gz    xrdp-sesman.log
alternatives.log.2.gz   auth.log.4.gz          dpkg.log.1       icecast2        mail.log.2.gz  tor            xrdp-sesman.log.1.gz
alternatives.log.3.gz   btmp                   dpkg.log.10.gz   installer       mail.log.3.gz  user.log       xrdp-sesman.log.2.gz
alternatives.log.4.gz   btmp.1                 dpkg.log.11.gz   journal         mail.log.4.gz  user.log.1     xrdp-sesman.log.3.gz
alternatives.log.5.gz   cloud-init.log         dpkg.log.12.gz   kern.log        mail.warn      user.log.2.gz  xrdp-sesman.log.4.gz
alternatives.log.6.gz   cloud-init-output.log  dpkg.log.2.gz    kern.log.1      messages       user.log.3.gz
alternatives.log.7.gz   cron.log               dpkg.log.3.gz    kern.log.2.gz   mysql          user.log.4.gz
alternatives.log.8.gz   cron.log.1             dpkg.log.4.gz    kern.log.3.gz   private        wtmp
alternatives.log.9.gz   cron.log.2.gz          dpkg.log.5.gz    kern.log.4.gz   README         wtmp.1
apache2                 cron.log.3.gz          dpkg.log.6.gz    lastlog         runit          xrdp.log
ls /var/log/apache2/
ls: cannot open directory '/var/log/apache2/': Permission denied
tail /var/log/auth.log
tail: cannot open '/var/log/auth.log' for reading: Permission denied
tree /home/ -L 2

shows unwanted results.

```bash ls /var/log/ ``` <details> <summary>Output:</summary> ``` alternatives.log apt cron.log.4.gz dpkg.log.7.gz letsencrypt syslog xrdp.log.1.gz alternatives.log.1 auth.log daemon.log dpkg.log.8.gz mail.err syslog.1 xrdp.log.2.gz alternatives.log.10.gz auth.log.1 dbconfig-common dpkg.log.9.gz mail.info syslog.2.gz xrdp.log.3.gz alternatives.log.11.gz auth.log.2.gz debug faillog mail.log syslog.3.gz xrdp.log.4.gz alternatives.log.12.gz auth.log.3.gz dpkg.log fontconfig.log mail.log.1 syslog.4.gz xrdp-sesman.log alternatives.log.2.gz auth.log.4.gz dpkg.log.1 icecast2 mail.log.2.gz tor xrdp-sesman.log.1.gz alternatives.log.3.gz btmp dpkg.log.10.gz installer mail.log.3.gz user.log xrdp-sesman.log.2.gz alternatives.log.4.gz btmp.1 dpkg.log.11.gz journal mail.log.4.gz user.log.1 xrdp-sesman.log.3.gz alternatives.log.5.gz cloud-init.log dpkg.log.12.gz kern.log mail.warn user.log.2.gz xrdp-sesman.log.4.gz alternatives.log.6.gz cloud-init-output.log dpkg.log.2.gz kern.log.1 messages user.log.3.gz alternatives.log.7.gz cron.log dpkg.log.3.gz kern.log.2.gz mysql user.log.4.gz alternatives.log.8.gz cron.log.1 dpkg.log.4.gz kern.log.3.gz private wtmp alternatives.log.9.gz cron.log.2.gz dpkg.log.5.gz kern.log.4.gz README wtmp.1 apache2 cron.log.3.gz dpkg.log.6.gz lastlog runit xrdp.log ``` </details> ```bash ls /var/log/apache2/ ``` ``` ls: cannot open directory '/var/log/apache2/': Permission denied ``` ```bash tail /var/log/auth.log ``` ``` tail: cannot open '/var/log/auth.log' for reading: Permission denied ``` ```bash tree /home/ -L 2 ``` shows unwanted results.
Author
Owner

DuckDuckGo and Google search Linux chmod remove permissions.

DuckDuckGo and Google search *Linux chmod remove permissions*.
Author
Owner
chmod o-rx -R .

seems to meet my needs.

Source: the Ask Ubuntu answer 1129487

```bash chmod o-rx -R . ``` seems to meet my needs. Source: [the Ask Ubuntu answer 1129487](https://askubuntu.com/a/1129487)
Author
Owner
head /file.swap 
head: cannot open '/file.swap' for reading: Permission denied
```bash head /file.swap ``` ``` head: cannot open '/file.swap' for reading: Permission denied ```
Author
Owner
[The Unix Stack Exchange question 61074](https://unix.stackexchange.com/q/61074)
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Benjamin_Loison/linux#42
No description provided.