Page 1 of 1

Linux/rPi Sudo Usage.

Posted: Thu 22 Jul 2021 6:33 am
by Phil23
Looking at this section but want to clarify the facts.

Code: Select all

All the Cumulus packages, should be put into a sub-folder called “CumulusMX” (note where capital letters must be used).
You can create that folder as you unzip a MX release, or you can type sudo mkdir EXISTING PATH/CumulusMX first (note that EXISTING PATH is explained above and always starts with a slash “/”).
It is best to change permissions for the "CumulusMX" sub-folder, chmod ugo+rwx CumulusMX will give full rights to the folder, so that "sudo" is not needed to run an executable there, and you can read/update any file in the folder regardless of which user you have logged in.
If the directory is created with Sudo, it's owner & group would then be root:root, so even if chmod is performed, user pi would not have access to that directory.

I am finding similar issues when running under Sudo Vs Pi.
I can run under pi, but if I then run a session under Sudo, that session will create new folders & on rollovers new files that are owned by root.
Then going back to running as pi will have issues unless ownership is changed.

Don't want to change Wiki wording if I am not correct.

Re: Linux/rPi Sudo Usage.

Posted: Thu 22 Jul 2021 9:30 am
by freddie
Phil23 wrote: Thu 22 Jul 2021 6:33 am Looking at this section but want to clarify the facts.

Code: Select all

All the Cumulus packages, should be put into a sub-folder called “CumulusMX” (note where capital letters must be used).
You can create that folder as you unzip a MX release, or you can type sudo mkdir EXISTING PATH/CumulusMX first (note that EXISTING PATH is explained above and always starts with a slash “/”).
It is best to change permissions for the "CumulusMX" sub-folder, chmod ugo+rwx CumulusMX will give full rights to the folder, so that "sudo" is not needed to run an executable there, and you can read/update any file in the folder regardless of which user you have logged in.
If the directory is created with Sudo, it's owner & group would then be root:root, so even if chmod is performed, user pi would not have access to that directory.
That's not true. If you do chmod ugo+rwx you are giving every user full access. You may not be able to edit files in that directory if they are not owned by you, but you will be able to delete them. IMHO using the ugo+rwx is bad practice. Better to use chown to assign ownership to the pi user.
Phil23 wrote: Thu 22 Jul 2021 6:33 am I am finding similar issues when running under Sudo Vs Pi.
I can run under pi, but if I then run a session under Sudo, that session will create new folders & on rollovers new files that are owned by root.
Then going back to running as pi will have issues unless ownership is changed.
It's best to use a less privileged user. It is definitely not a good idea to run in one session as root and then at a future time as pi. I don't understand why you would want to do that, as it will lead to permissions problems as you have found.

Re: Linux/rPi Sudo Usage.

Posted: Thu 22 Jul 2021 10:42 am
by Phil23
Thanks for the clarification.

And no I don't intend to run sessions as root & then pi, but from the outlines in the Wiki it was not clear that by default, when running as a service MX ran as root.

Other information stated how to run under a normal user and that was where I got tripped up.
Followed the outline & set permissions & ran as pi in a session, then tried as a service, which worked fine, but tripped me up when I went back & tried to run in a console session again.


Phil

Re: Linux/rPi Sudo Usage.

Posted: Thu 22 Jul 2021 9:21 pm
by Phil23
Other thing, can someone look at what I've got wrong here, the blank line in the left column on the table.

My intention was to add the blank lines for better readability.
(I do see an unexpected </tr> in the source).
Screenshot 2021-07-23 071632.jpg

Re: Linux/rPi Sudo Usage.

Posted: Fri 23 Jul 2021 9:34 pm
by sfws
Phil23 wrote: Thu 22 Jul 2021 9:21 pm My intention was to add the blank lines for better readability.
Thank you for those good intentions. As Freddie's message (pink area) says, it is helpful when other people contribute to the Wiki, especially if they make new pages, but improving existing content is also great.

In Wiki code formatting, "<code> </code>" is not intended to have formatting (even codes like <br>) within it. You would use <pre> </pre> instead to get content between those codes formatted as it is typed in including any line breaks.

Add the Mono repository for a Raspberry Pi does look much better thanks to your idea, I used CSS styling for the spacing within Wiki code syntax.
By the way, you increased the table width; in this case I have kept that. I most often view the Wiki, and do small edits, using my mobile. Contributors should be aware that the wide tables that may look better in a landscape view on a wide screen using computer, can make the font tiny, and possibly unreadable, when viewed on a mobile device in portrait view.

Re: Linux/rPi Sudo Usage.

Posted: Sun 25 Jul 2021 2:26 am
by Phil23
I do notice that the border on the table is now removed & also the formatting of what follows below is changed.
Was that by intent.

If it was to stay as a table maybe a 2 x 5 row table would provide clear separation of each line required & pack it up within a bordered box.

Edit:- Added another table in above your edits.
Please delete if it's an inappropriate change.

Did consider also adding the other lines required & listing their purpose above.

Phil.

Re: Linux/rPi Sudo Usage.

Posted: Sun 25 Jul 2021 2:51 am
by Phil23
Noticed also BEFORE my last edit that the formatting of all sections after USB HID have changed to a different font.

Could that be related to the CSS styling changes?
Example below.

Re: Linux/rPi Sudo Usage.

Posted: Sun 25 Jul 2021 3:33 am
by Phil23
And for some reason I see this in the preview but it must be caching when saved.
(Resolved. Missed the Captcha).

Re: Linux/rPi Sudo Usage.

Posted: Sun 25 Jul 2021 4:09 am
by Phil23
Found this:-

=== USB HID ===

There is one more prerequisite package for MX with some weather station types.

The cross-platform [https://www.nuget.org/packages/HidSharp/ Universal Serial Bus (USB) Human Interface Device (HID) library] used by MX to connect to weather stations that appear as a HID connecting via USB (like Fine Offset and USB connected Oregon Scientific models) calls a package file called ''libudev.so.1'', so you may need to [[#install|search]] your Linux computer for this file, and [[#install]] it if it is missing. Alternatively, you might just need a symbolic link where MX looks to where the file is.

To check your USB devices, type

Code: Select all

sudo lsusb -t


To check HID, download this [download/file.php?id=11414 USB HID test package] and run it.

Replaced ) with >.