Setting file and script permissions
Hi everyone,
This one is still a little too hard to get my head around. I've got a root script which (depending on a certain condition) decides whether or not to call a backup script. This backup script needs to run with user privileges, and not with root privileges. The backup script will call the rsync deamon and will write files to the users backup directory. So the owner of the backup directory will be the one that calls the backup script with his/her user privileges. The root script does a chown of backup directory and then I execute a su to the correct user just before executing the backup script. I've been experimenting with chown but that does not allow the back up script to delete or add stuff. Simply said, I don't know which commands to run to accomplish this task. Any help is more than welcome:newbie: |
when I switch to the user (terminal window) who should be able to access his folder, I keep getting
cd: 2: can't cd to jeroen. I did a chown user:user and chmod 777 but to no avail. What am I missing here? below is the output from ls -l the user 'jeroen' should be able to access his directory, also called 'jeroen' Code:
drwxrwxrwx 7 jeroen jeroen 4096 2009-10-05 12:37 jeroen |
Did you try running:
chmod 7666 on the dir? |
Quote:
Code:
drwsrwsrwT 7 jeroen jeroen 4096 2009-10-05 12:37 jeroen |
Don't use /root to contain users' backups. You should use it in only very rare occasions.
A user needs read and execute writes to the parent directory to save files in /root/. You don't want that. A network NAS or external drive would make more sense. If your computer's drive becomes damaged, your backup and the original documents are on the same machine. Rsync can clone the permissions of files when copying them. Using su isn't necessary unless your reason is that you don't want your cron job running as root. |
Quote:
The only reason that normal users have access to their own files under /home is because /home has these permissions: Code:
drwxr-xr-x /home Code:
drwxr-xr-x / Think of it as a set of doors to an inner sanctum -- you have to be able to pass through each door before accessing the treasure. |
Quote:
|
All times are GMT -5. The time now is 07:11 AM. |