rohtua
Posts: 67
Joined: Sat Jul 16, 2016 9:01 am

OpenMediaVault issues

Sun Dec 31, 2017 1:02 pm

Hi, I've recently decided to run my NAS from a Pi using OpenMediaVault. I've hit a few speed bumps however in as much as the default username and password for the CLI (root/openmediavault) don't work. Accessing the Pi via OMV's web gui did work but did not list any users under the users section. I added a user and added the user to the groups for SSH, sudo etc. which now lets me logon via the SSH and the CLI. Now my issue lies in the session that is generated each time I login does not seem to account for any of my preferences. For example I've setup the .bashrc files to add a path for a scripts folder which works on all my other Pi's running raspian but not on OMV each time I login it does not remember my path. I have to run export PATH=$PATH...... to be able to run my scripts. I've currently also setup a cron job to run the export command daily after a reboot but again it does not appear to stick if I leave the session and start a new one.

In addition to this there is a particular script I would like to run at the same time each day but requires sudo privileges. With my previous setup running the NAS from raspian this did not matter as raspain lets the user use sudo without having to enter their password however on OMV I have to enter the password each time I use sudo. Thats fine but not when I want to automate this script. I've tried editing the sudoers file to add NOPASSWD privileges for the path to my script. This resulted in an error where the sudoers file could not be parsed which I've had to restore it. I then tried adding the NOPASSWD option for all commands issued by my user which it seemed to accept but each time I start a new session and use sudo I have to enter the password. So it appears that again my setup is not being saved. I've checked all the files I've edited sudoers and crontab and my edits are there but just don't seem to be having any effect on my setup. Any help in understanding why and what i can do to fix it would be appreciated.

User avatar
Jednorozec
Posts: 809
Joined: Sun Nov 24, 2013 2:17 pm
Location: Deposit, NY

Re: OpenMediaVault issues

Sun Dec 31, 2017 2:17 pm

The most important leg of a three legged stool is the one that's missing.
It's called thinking. Why don't you try it sometime?

rohtua
Posts: 67
Joined: Sat Jul 16, 2016 9:01 am

Re: OpenMediaVault issues

Sun Dec 31, 2017 2:32 pm

Thanks for that, I'm sure there will be people here as well who can help also.

Also I've just tried posting on the above link, it doesn't work. Anything I try to post just disappears when I press submit and I get a random error code.

rohtua
Posts: 67
Joined: Sat Jul 16, 2016 9:01 am

Re: OpenMediaVault issues

Mon Jan 01, 2018 9:30 am

Hi All.

I think I've fixed most of my issues so I thougt I'd add my fixes here in case it help any one else.

1) Probably a bit naive of me but I didn't realise the sudoers file took into account the order in which I add the setting for users to it. So when I put in the NOPASSWD option for my user as the last setting in the file all worked fine

2) The big issue for me was my custom bash scripts, I didn't want to have keep doing the export PATH=$PATH....... command each time I logged in via SSH. I'm not sure if its intentional but when OMV generates the users home directories it doesn't (or didn't in my case at least) generate a .profile file to tell the shell too use the .bashrc file, I copied over the .profile file generated for the root user and bingo my .bashrc file is working along with my custom scripts.

The only thing that doesn't seem to be working like it did on raspian is using those custom scripts in a cron job, i.e. I've created a script to backup one HDD to another overnight. on raspian all I had to do once I'd added the script to my PATH was open up cron (with crontab -e) and put in the time of day I wanted the job to run and the name of the script which doesn't seem to be happening.

On raspian the line in my cron file looked like this:

0 3 * * * backup-hdd

that worked to backup my HDD overnight at 3AM, the same setup on OMV however has no effect. The script works if I login and run backup-hdd but not when I leave it to cron to run it. Obviously I could just put the command from the script into cron file and that will run or (I'm assuming here) I could put the full path to my script in and that should work which is fine but if there is something I could do to make it run in the same way as it does on raspian it'd be great if someone could help!! After all I put the command into a script to simply using it all the timeto backup the HDD. Any help with this last issue would be greatly appreciated. :D

PcMac
Posts: 12
Joined: Wed Mar 28, 2018 8:55 am

Re: OpenMediaVault issues

Wed Mar 28, 2018 5:37 pm

Please go through these videos and you will find out all your answers.

https://www.youtube.com/watch?v=LcL_izU ... x9KXXMibKa

Return to “General discussion”