Please note the new address for this forum : forum.excito.org. The old address redirects here but I don't know for how long. Thanks !
New user's registration have been closed due to high spamming and low trafic on this forum. Please contact forum admins directly if you need an account. Thanks !

Permissions Error

Got problems with your B2 or B3? Share and get helped!
jovisuk
Posts: 65
Joined: 12 Sep 2010, 04:20

Permissions Error

Post by jovisuk »

Hi Guys,

Back on the RSync backup, have just started to setup the CRON job to run it automatically, but am getting the following issue:

I've created the backup script which is:

GNU nano 2.2.4 File: backup-script

#!/bin/sh

rsync -av -e "ssh -i /home/backup-user/cron/backup-bubba-rsync-key" main-user@main-bubba:/home/
/home/backup-user/backup/

The result of which is below - it's saying that permission is denied on the folder /home/backup-user/backup on the backup-bubba - even though previous to this I have run a test backup to the folder which worked?

The active permissions are:

backup-user@backup-bubba:~$ ls -l
total 20
drwxrwxrwx 4 backup-user users 4096 Nov 5 19:57 backup
drwxrwxrwx 2 backup-user users 4096 Nov 9 12:15 cron
drwxr-x--- 2 backup-user users 4096 Sep 13 11:47 downloads
drwx------ 2 backup-user users 4096 Sep 13 11:47 private
drwx------ 2 backup-user users 4096 Sep 13 11:47 torrents
backup-user@backup-bubba:~$

Results of the CRON Job:

backup-user@backup-bubba:~/cron$ ./backup-script
receiving incremental file list
drwxr-xr-x 4096 2010/11/08 18:35:24 .
rsync: opendir "/home/chrisward/torrents" failed: Permission denied (13)
drwxrwxrwx 4096 2010/11/08 18:35:11 Level_One
drwxrwxrwx 4096 2010/11/08 18:35:24 Level_Three
drwxrwxrwx 4096 2010/11/08 18:35:18 Level_Two
drwxr-xr-x 4096 2000/01/20 18:19:32 admin
-rw-r--r-- 220 2010/04/10 14:19:44 admin/.bash_logout
-rw-r--r-- 3184 2010/04/10 14:19:44 admin/.bashrc
-rw-r--r-- 37 2010/11/02 16:16:03 admin/.bubbacfg
-rw-r--r-- 675 2010/04/10 14:19:44 admin/.profile
drwxr-xr-x 4096 2010/11/09 11:28:42 chrisward
-rw-r--r-- 220 2010/04/10 14:19:44 chrisward/.bash_logout
-rw-r--r-- 3184 2010/04/10 14:19:44 chrisward/.bashrc
-rw-r--r-- 675 2010/04/10 14:19:44 chrisward/.profile
drwxr-x--- 4096 2010/09/13 11:47:36 chrisward/downloads
rsync: opendir "/home/joehenstridge/torrents" failed: Permission denied (13)
rsync: opendir "/home/lauramorrison/torrents" failed: Permission denied (13)
rsync: opendir "/home/lost+found" failed: Permission denied (13)
rsync: opendir "/home/lukestephens/torrents" failed: Permission denied (13)
rsync: opendir "/home/stevespicer/torrents" failed: Permission denied (13)
rsync: opendir "/home/tomstephens/torrents" failed: Permission denied (13)
drwx------ 4096 2010/09/13 11:47:36 chrisward/torrents
drwxr-xr-x 4096 2010/11/09 11:25:58 joehenstridge
-rw-r--r-- 220 2010/04/10 14:19:44 joehenstridge/.bash_logout
-rw-r--r-- 3184 2010/04/10 14:19:44 joehenstridge/.bashrc
-rw-r--r-- 675 2010/04/10 14:19:44 joehenstridge/.profile
drwxr-x--- 4096 2010/09/13 11:47:36 joehenstridge/downloads
drwx------ 4096 2010/09/13 11:47:36 joehenstridge/torrents
drwxr-xr-x 4096 2010/11/09 11:28:29 lauramorrison
-rw-r--r-- 220 2010/04/10 14:19:44 lauramorrison/.bash_logout
-rw-r--r-- 3184 2010/04/10 14:19:44 lauramorrison/.bashrc
-rw-r--r-- 675 2010/04/10 14:19:44 lauramorrison/.profile
drwxr-x--- 4096 2010/09/13 11:47:36 lauramorrison/downloads
drwx------ 4096 2010/09/13 11:47:36 lauramorrison/torrents
drwx------ 16384 2000/01/20 18:18:04 lost+found
drwxr-xr-x 4096 2010/11/09 11:29:20 lukestephens
-rw-r--r-- 220 2010/04/10 14:19:44 lukestephens/.bash_logout
-rw-r--r-- 3184 2010/04/10 14:19:44 lukestephens/.bashrc
-rw-r--r-- 675 2010/04/10 14:19:44 lukestephens/.profile
drwxr-x--- 4096 2010/09/13 11:47:36 lukestephens/downloads
drwx------ 4096 2010/09/13 11:47:36 lukestephens/torrents
drwxr-xr-x 4096 2010/11/05 19:52:36 main-user
-rw------- 1889 2010/11/09 11:33:48 main-user/.bash_history
-rw-r--r-- 220 2010/04/10 14:19:44 main-user/.bash_logout
-rw-r--r-- 3184 2010/04/10 14:19:44 main-user/.bashrc
-rw-r--r-- 675 2010/04/10 14:19:44 main-user/.profile
drwx------ 4096 2010/11/05 16:54:52 main-user/.ssh
-rw------- 852 2010/11/05 16:55:58 main-user/.ssh/authorized_keys
-rw-r--r-- 238 2010/11/05 16:54:52 main-user/.ssh/backup-bubba-rsync-key-new.pub
-rw-r--r-- 614 2010/11/04 14:08:52 main-user/.ssh/backup-bubba-rsync-key.pub
drwxr-x--- 4096 2010/09/13 11:47:36 main-user/downloads
drwx------ 4096 2010/09/13 11:47:36 main-user/private
drwxrwxrwx 4096 2010/11/05 19:53:58 main-user/something_to_backup
drwxrwxr-x 4096 2010/11/05 19:54:09 main-user/something_to_backup/Test Folder
-rwxrw-r-- 41 2010/11/05 19:54:24 main-user/something_to_backup/Test Folder/Back Me Up.txt
drwx------ 4096 2010/09/13 11:47:36 main-user/torrents
drwxr-xr-x 4096 2010/11/09 11:28:58 stevespicer
-rw-r--r-- 220 2010/04/10 14:19:44 stevespicer/.bash_logout
-rw-r--r-- 3184 2010/04/10 14:19:44 stevespicer/.bashrc
-rw-r--r-- 675 2010/04/10 14:19:44 stevespicer/.profile
drwxr-x--- 4096 2010/09/13 11:47:36 stevespicer/downloads
drwx------ 4096 2010/09/13 11:47:36 stevespicer/torrents
drwxrwsrwx 4096 2010/11/08 22:56:53 storage
-rw-rw-rw- 6148 2010/11/08 22:56:58 storage/.DS_Store
drwxrwsrwx 4096 2010/11/08 22:56:51 storage/.AppleDesktop
-rw-rw-rw- 218 2010/11/08 22:56:52 storage/.AppleDesktop/.volinfo
drwxrwsrwx 4096 2010/11/08 22:56:53 storage/.AppleDouble
-rw-rw-rw- 741 2010/11/08 22:56:53 storage/.AppleDouble/.DS_Store
-rw-rw-rw- 741 2010/11/08 22:56:53 storage/.AppleDouble/.Parent
drwxrwsrwx 4096 2010/11/08 22:56:53 storage/Level One
drwxrwsrwx 4096 2010/11/08 22:56:53 storage/Level One/.AppleDouble
-rw-rw-rw- 741 2010/11/08 22:56:53 storage/Level One/.AppleDouble/.Parent
drwxrwsrwx 4096 2010/11/08 22:56:53 storage/Level Three
drwxrwsrwx 4096 2010/11/08 22:56:53 storage/Level Three/.AppleDouble
-rw-rw-rw- 741 2010/11/08 22:56:53 storage/Level Three/.AppleDouble/.Parent
drwxrwsrwx 4096 2010/11/08 22:56:53 storage/Level Two
drwxrwsrwx 4096 2010/11/08 22:56:53 storage/Level Two/.AppleDouble
-rw-rw-rw- 741 2010/11/08 22:56:53 storage/Level Two/.AppleDouble/.Parent
drwxrwsrwx 4096 2010/11/08 22:56:51 storage/Network Trash Folder
drwxrwsrwx 4096 2010/11/08 22:56:51 storage/Network Trash Folder/.AppleDouble
-rw-rw-rw- 741 2010/11/08 22:56:53 storage/Network Trash Folder/.AppleDouble/.Parent
drwxrwsrwx 4096 2010/11/08 22:56:51 storage/Temporary Items
drwxrwsrwx 4096 2010/11/08 22:56:51 storage/Temporary Items/.AppleDouble
-rw-rw-rw- 741 2010/11/08 22:56:53 storage/Temporary Items/.AppleDouble/.Parent
drwxrwsr-x 4096 2010/11/08 22:56:53 storage/extern
drwxrwsr-x 4096 2010/11/08 22:56:53 storage/extern/.AppleDouble
-rw-rw-rw- 741 2010/11/08 22:56:53 storage/extern/.AppleDouble/.Parent
drwxr-xr-x 4096 2010/11/09 11:29:09 tomstephens
-rw-r--r-- 220 2010/04/10 14:19:44 tomstephens/.bash_logout
-rw-r--r-- 3184 2010/04/10 14:19:44 tomstephens/.bashrc
-rw-r--r-- 675 2010/04/10 14:19:44 tomstephens/.profile
drwxr-x--- 4096 2010/09/13 11:47:36 tomstephens/downloads
drwx------ 4096 2010/09/13 11:47:36 tomstephens/torrents
drwxrwsr-x 4096 2000/01/20 18:19:31 web
-rw-r--r-- 927 2010/06/28 16:33:32 web/index.html

sent 57 bytes received 3126 bytes 6366.00 bytes/sec
total size is 49524 speedup is 15.56
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1526) [generator=3.0.7]
./backup-script: 4: /home/backup-user/backup/: Permission denied
backup-user@backup-bubba:~/cron$
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: Permissions Error

Post by Ubi »

You are entering the systems as a particular user that does not have rights to the entire system. If that is what you want than you need to enter as root, which brings all kinds of security issues. It's not impossible to do safely though. Use this recipe:http://www.howtoforge.com/mirroring_with_rsync

Ubi
jovisuk
Posts: 65
Joined: 12 Sep 2010, 04:20

Re: Permissions Error

Post by jovisuk »

Ok, so got round to working on this, and guess what - more issues . . . .

So when trying to edit the .ssh/authorized_key file I can't, I'm doing:

vi /home/USERNAME/.ssh/authorized_keys

Brings up a new screen and nothing responds, cannot type anything and cannot exit without crashing out the session - is there another way of editing the file and adding in the code?

Also, another issue is that on my main-bubba I have created the custom file structure with custom permissions to the folder /home/COMPANY so that now when I test a backup, the backup-bubba fails to back anything up in this directory as it has no permissions to the folder. Can I add backup-user as an authorised user to that folder on the main-bubba, even though the user account is from another bubba unit?

Am I making sense and can what I'm asking for be done?
ryz
Posts: 183
Joined: 12 Feb 2009, 06:03

Re: Permissions Error

Post by ryz »

You should not use vi if you do not know how vi works. vi I very powerful but also extremely hard to use for a beginner. I would say that it is impossible to use it without reading an manual on how to use it first. One of the reason people says you should use vi is because thats the only editing program that you can be sure exist in all Linux/Unix system.

I suggest that you install nano and use that program instead. Remember that the following command needs to be run by root.

Code: Select all

apt-get install nano
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: Permissions Error

Post by Ubi »

and the answer to exit from vi is: pres the escape key, and then

Code: Select all

wq
to save data. or press escape and then

Code: Select all

q!
to exit without saving. Press escape and then

Code: Select all

i
to go into editing mode. But nano is probably easier to use. I always use joe as an editor.
RandomUsername
Posts: 904
Joined: 09 Oct 2009, 18:49

Re: Permissions Error

Post by RandomUsername »

Pretty sure nano was pre-installed on my B2.
jovisuk
Posts: 65
Joined: 12 Sep 2010, 04:20

Re: Permissions Error

Post by jovisuk »

Thanks for the replies, I have tried nano - I tried it before using vi as I wasn't sure how vi worked (Curiosity got the better of me so I tried vi)

I should have mentioned that when I tried:

nano authorized_keys

The file opens up but appears empty??? Unless it's not empty and the file contents are hidden???
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: Permissions Error

Post by Ubi »

or it means you're in the wrong place. try nano autho and press TAB before pressing enter. If the file exists then the shell will add the remaining letters (also known as tab completion). It's a good safeguard against typos too
jovisuk
Posts: 65
Joined: 12 Sep 2010, 04:20

Re: Permissions Error

Post by jovisuk »

Cheers again Ubi - SOLVED.

nano auth (then pressing TAB) solved it
jovisuk
Posts: 65
Joined: 12 Sep 2010, 04:20

Re: Permissions Error

Post by jovisuk »

Hi Again,

Been running this and checked the backup-script

But it says it has access denied to the destination for the backup files, which is:

/home/backup-user/backup

The backup-script is:

rsync -av -e "ssh -i /home/backup-user/cron/backup-Bubba-rsync-key" main-user@main-Bubba:/home/ /home/backup-user/backup/

Any ideas?
jovisuk
Posts: 65
Joined: 12 Sep 2010, 04:20

Re: Permissions Error

Post by jovisuk »

This is the end result after trying to run the backup script:

sent 199 bytes received 33784 bytes 3577.16 bytes/sec
total size is 629017573 speedup is 18509.77
./backup-script: 4: /home/backup-user/backup/: Permission denied
backup-user@backup-bubba:~/cron$
Ubi
Posts: 1549
Joined: 17 Jul 2007, 09:01

Re: Permissions Error

Post by Ubi »

You're asking the same question again. I'd be polite to read answers to your questions before asking more
jovisuk
Posts: 65
Joined: 12 Sep 2010, 04:20

Re: Permissions Error

Post by jovisuk »

Hi, thanks for the response - but you don't understand:

My question has not been answered, the initial problem was that I was getting Permission Denied, I then worked on it and couldn't edit the Authorized_keys file and then was able to after your help (thanks) - hence me saying SOLVED for that part (Granted this could have been confusing) but my problem still remains, I don't understand why I am getting permission denied on the /home/backup-user/backup directory when running the script?

Thanks again
ryz
Posts: 183
Joined: 12 Feb 2009, 06:03

Re: Permissions Error

Post by ryz »

So which user is running the cron job? That is how have you set up the cron job?
jovisuk
Posts: 65
Joined: 12 Sep 2010, 04:20

Re: Permissions Error

Post by jovisuk »

Hi, I did it all on the backup-bubba logged in as backup-user

That's why I cannot understand why it says "Permission Denied"

Is it worth starting again and creating a new cron job??
Post Reply