IRC:notowner [2020-01-22]

About

Broken ownership of files is besides wrong file permissions one of the more common issues affecting users not being aware of the side effects of running commands with sudo, or by working as root at the home-directory of the user.

Be aware: This tutorial does target the case, where only the owner-ship of (config-) files is broken. If you suspect the structure of a config-file to be defective, you might want to have additionally a look at IRC:fixconfig.htm.

Remarks

share output with IRC

To share (other) output with others use http://dpaste.com for example (see note-1). Copy&paste your output there, press the "Paste it"-button and share the created url with the people at the IRC-channel to give them access to it.

If you want to share output directly at IRC: avoid to paste more than 3 lines, as this is seen as "flooding" / "disrupting" the channel. If you are exceeding predefined limits, mintbotd will mute (block) you for about 1 minute to stop you from flooding the channel; you wont be able to write at the channel for this period.

Copy&Paste - terminal hotkeys

The behavior of a terminal regarding the usage of common hotkeys for copy&paste is a bit unexpected for new linux-users. As CTRL+c is already used in terminals to abort running commands, one has to use: SHIFT+CTRL+c instead to copy marked text from the terminal to the clipboard. And to keep the hotkeys consistent you have to use SHIFT+CTRL+v to paste text from the clipboard to the terminal.

Using sudo to get elevated rights

If using commands with sudo, you will get ask for your users password. (with older mint-versions, your will get no feedback shown while entering it; newer mint-versions will show some asterisks * while entering it)

Check owner-ship of files & folders ...

To check for broken owner-ship of files and folders you could use either the following "notowner.sh" helper-script, or use a find-command to list related files/folders as given below (just read below).

... using the "notowner.sh" helper-script

The script does offer simple options for less experienced users and asks, if you want to run commands with sudo or upload output to a paste-service without having to fiddle with the command-line too much.

The one-liner - nothing left behind

If you just want to run the helper-script without keeping a copy of it, Copy&Paste the following line to your terminal:

source <(wget https://www.orcus.de/Entities/linux/notowner.sh -O - 2>/dev/null)

Get the script permanently, make it executable and run

In case you want to keep a copy of the script for later use or need to run the command using sudo:

"cd" into some folder where you keep your common scripts.

To download the script, make it executable and run it as your regular user, Copy&Paste the following lines to your terminal:

wget https://www.orcus.de/Entities/linux/notowner.sh
chmod +x notowner.sh
./notowner.sh

To run the script as root-user (might be needed if owner-ship and/or persmissions of files/folders are broken a bit more), you can run the command using sudo with it:

sudo ./notowner.sh

... using regular commands

The above helper-script does nothing magically, but uses some general available commands, which you could use directly too to gather some basic information.

List files&folders not being owned by the current user at his home-directory

find ~ ! \( -user $USER -o -group $USER \) -exec ls  -aFld {} \;

List files&folders ... using sudo

In case your ownership is broken a bit more, you will likely not be able to access some of the nested sub-folders; which you can bypass to a certain degree by using the find-command with prepending sudo... (which will ask for your password)

sudo find ~ ! \( -user $USER -o -group $USER \) -exec ls  -aFld {} \;

List files&folders ... posting the output to a paste-service (termbin.com)

You can redirect the output of "find" to an paste-service and share the shown url with supporters at IRC by (add sudo in front as needed).

find ~ ! \( -user $USER -o -group $USER \) -exec ls  -aFld {} \;|nc termbin.com 9999

The output will be an url, which you could open in your browser (right-click onto the shown url to open it via context-menu) - copy the url to the IRC channel if you need assistance with the shown files/folders.

Related information

IRC:copy-paste.htmcopy&paste commands and output between hexchat and terminal
IRC:fixconfig.htmTest and reset corrupted config-files of a user.

© 1998-2023 by ORCUS® GmbH - www.orcus.de (imprint) - we strictly do not track (period) - details: privacy - overview IRC: IRC support

note-1: not tracking does mean too - we are strictly NOT using direct external links within the content = we bother you having to copy&paste offered URLs