Local backup folder not found and perms not working on ssh

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
dfmco
Posts: 257
Joined: Wed Dec 04, 2013 11:05 am

Local backup folder not found and perms not working on ssh

Post by dfmco »

I created the directory and set permissions as follows:
chmod u+rw /home/nagiosbackup/localbackup
chmod g+rw /home/nagiosbackup/localbackup
chown nagios:nagios /home/nagiosbackup/localbackup

But when I try to test permissions to that directory, Nagios says the directory does not exist. Is there an issue using sub-directories as if I go one level up, it does find the directory and it works.

For ssh permissions, do I use permissions for the remote user or set to nagios:nagios?
Last edited by dfmco on Mon Jun 06, 2016 10:36 am, edited 1 time in total.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Local backup folder not found and perms not working on s

Post by lmiltchev »

Is this a local or SSH backup? You are talking about both... What is the output of the following commands?

Code: Select all

ls -lad /home
ls -la /home
ls -la /home/nagiosbackup
Is the "/home/nagiosbackup/localbackup" directory located on your Nagios XI server or on a remote box?
Be sure to check out our Knowledgebase for helpful articles and solutions!
dfmco
Posts: 257
Joined: Wed Dec 04, 2013 11:05 am

Re: Local backup folder not found and perms not working on s

Post by dfmco »

I am having a problem with both local (saving locally) and ssh (saving remotely). Accounts are set up on both the local and remote servers with permissions set per the commands in the original post.

[root@rbuc-monitor ~]# ls -lad /home
drwxr-xr-x. 5 root root 57 May 27 03:38 /home
[root@rbuc-monitor ~]# ls -la /home
total 20
drwxr-xr-x. 5 root root 57 May 27 03:38 .
dr-xr-xr-x. 19 root root 4096 Jun 1 07:19 ..
drwx------. 2 configbackup configbackup 8192 Jun 1 12:27 configbackup
drwx------. 3 nagios nagios 87 May 25 07:42 nagios
drwxrw----. 4 nagios nagios 4096 Jun 2 07:58 nagiosbackup
[root@rbuc-monitor ~]# ls -la /home/nagiosbackup
total 690832
drwxrw----. 4 nagios nagios 4096 Jun 2 07:58 .
drwxr-xr-x. 5 root root 57 May 27 03:38 ..
-rw-rw-r--. 1 nagios nagios 18 Nov 19 2015 .bash_logout
-rw-rw-r--. 1 nagios nagios 193 Nov 19 2015 .bash_profile
-rw-rw-r--. 1 nagios nagios 231 Nov 19 2015 .bashrc
drwxrwxr-x 2 nagios nagios 6 Jun 2 07:58 localbackup
-rw-rw-r--. 1 nagios nagios 115433577 May 27 00:00 nagiosxi.1464325201.tar.gz
-rw-rw-r--. 1 nagios nagios 116938423 May 28 00:00 nagiosxi.1464411602.tar.gz
-rw-rw-r--. 1 nagios nagios 117871105 May 29 00:00 nagiosxi.1464498002.tar.gz
-rw-rw-r--. 1 nagios nagios 118586010 May 30 00:00 nagiosxi.1464584402.tar.gz
-rw-rw-r--. 1 nagios nagios 119030822 May 31 00:00 nagiosxi.1464670801.tar.gz
-rw-rw-r--. 1 nagios nagios 119518506 Jun 1 00:00 nagiosxi.1464757201.tar.gz
drwxrwxr-x 2 nagios nagios 6 Jun 2 07:58 rbunwbackup

and here is the second server. Both have the same issue with the backups. I am doing ssh and local on each. Local backup is one copy and the ssh saves the backup to its partner.
[root@localhost ~]# ls -lad /home
drwxr-xr-x. 4 root root 38 May 13 03:04 /home
[root@localhost ~]# ls -la /home
total 8
drwxr-xr-x. 4 root root 38 May 13 03:04 .
dr-xr-xr-x. 18 root root 4096 May 10 21:09 ..
drwx------. 3 nagios nagios 87 May 10 21:08 nagios
drwxrw---- 4 nagios nagios 4096 Jun 2 08:28 nagiosbackup
[root@localhost ~]# ls -la /home/nagiosbackup
total 913600
drwxrw---- 4 nagios nagios 4096 Jun 2 08:28 .
drwxr-xr-x. 4 root root 38 May 13 03:04 ..
-rw-r--r-- 1 root root 103593064 Jun 2 08:28 20160602-rbuc.tar.gz
-rw-rw-r-- 1 nagios nagios 18 Nov 19 2015 .bash_logout
-rw-rw-r-- 1 nagios nagios 193 Nov 19 2015 .bash_profile
-rw-rw-r-- 1 nagios nagios 231 Nov 19 2015 .bashrc
drwxrwxr-x 2 nagios nagios 6 Jun 2 07:30 localbackup
-rw-rw-r-- 1 nagios nagios 115596580 May 27 00:59 nagiosxi.1464328742.tar.gz
-rw-rw-r-- 1 nagios nagios 116970345 May 28 00:59 nagiosxi.1464415141.tar.gz
-rw-rw-r-- 1 nagios nagios 117901240 May 29 00:59 nagiosxi.1464501541.tar.gz
-rw-rw-r-- 1 nagios nagios 118602381 May 30 00:59 nagiosxi.1464587941.tar.gz
-rw-rw-r-- 1 nagios nagios 119061727 May 31 00:59 nagiosxi.1464674342.tar.gz
-rw-rw-r-- 1 nagios nagios 119525248 Jun 1 00:59 nagiosxi.1464760741.tar.gz
-rw-rw-r-- 1 nagios nagios 124243011 Jun 2 01:00 nagiosxi.1464847141.tar.gz
drwxrwxr-x 2 nagios nagios 6 Jun 2 07:30 rbucbackup
-rw-rw-r-- 1 nagios nagios 110 May 13 03:06 ssh_test_secure_copy.txt
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Local backup folder not found and perms not working on s

Post by lmiltchev »

I believe the issue is caused by the fact that the "/home/nagiosbackup" is not executable. Run:

Code: Select all

chmod +x /home/nagiosbackup
and test the permissions again. Did this help?
Be sure to check out our Knowledgebase for helpful articles and solutions!
dfmco
Posts: 257
Joined: Wed Dec 04, 2013 11:05 am

Re: Local backup folder not found and perms not working on s

Post by dfmco »

Local works now but no luck on ssh. I did -R to recursively change permissions and that failed too. What permissions are needed on the target server for ssh? Should it be owned by nagios:nagios or the ssh id?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Local backup folder not found and perms not working on s

Post by lmiltchev »

What permissions are needed on the target server for ssh? Should it be owned by nagios:nagios or the ssh id?
Does the user that you ssh in as own the "backup" directory? Here's an example of permissions of my "backup" directory on the remote box:

Code: Select all

root@debian:~# ls -lad /home/lmiltchev
drwxr-xr-x 3 lmiltchev lmiltchev 4096 Mar 29  2015 /home/lmiltchev
root@debian:~# ls -lad /home/lmiltchev/backups/
drwxrwxrwx 2 lmiltchev lmiltchev 4096 Jun  6 10:13 /home/lmiltchev/backups/
root@debian:~# ls -la /home/lmiltchev/backups/
total 255528
drwxrwxrwx 2 lmiltchev lmiltchev      4096 Jun  6 10:13 .
drwxr-xr-x 3 lmiltchev lmiltchev      4096 Mar 29  2015 ..
-rw-r--r-- 1 lmiltchev lmiltchev 129941022 Jun  4 13:54 nagiosxi.1465066444.tar.gz
-rw-r--r-- 1 lmiltchev lmiltchev 131439818 Jun  5 13:54 nagiosxi.1465152844.tar.gz
-rw-r--r-- 1 lmiltchev lmiltchev       110 Jun  6 10:11 ssh_test_secure_copy.txt
Here's a couple of screenshot from my test XI box:
example01.PNG
example02.PNG
Hope this helps.
You do not have the required permissions to view the files attached to this post.
Be sure to check out our Knowledgebase for helpful articles and solutions!
dfmco
Posts: 257
Joined: Wed Dec 04, 2013 11:05 am

Re: Local backup folder not found and perms not working on s

Post by dfmco »

That did the trick! I changed ownership for the remote directory to the ssh user and it is working now. Thanks!
Locked