chown script

Come up with a useful post-processing script? Share it here!
Post Reply
stabu
Jr. Member
Jr. Member
Posts: 64
Joined: December 10th, 2008, 10:02 pm

chown script

Post by stabu »

Im trying to make a chown script for sabnzbd i have a .sh file that has "chmod -R usernamehere $1 but it will not run.
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: chown script

Post by rascalli »

how does it need to chmod  ???
There is no value set .. like 777 or 755 or whatever
stabu
Jr. Member
Jr. Member
Posts: 64
Joined: December 10th, 2008, 10:02 pm

Re: chown script

Post by stabu »

oops i ment chown
User avatar
rascalli
Moderator
Moderator
Posts: 656
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: chown script

Post by rascalli »

normally chown command is done like this in linux :

chown usernamehere:usernamehere -R $1
User avatar
jcfp
Release Testers
Release Testers
Posts: 1004
Joined: February 7th, 2008, 12:45 pm

Re: chown script

Post by jcfp »

Changing file ownership is privileged, i.e. your script won't work unless sab runs as root. Probably better to just start the application as the user you want to own the downloaded files.
stabu
Jr. Member
Jr. Member
Posts: 64
Joined: December 10th, 2008, 10:02 pm

Re: chown script

Post by stabu »

its running as root, thats the problem. Im running sabnzbd on freenas and trying to get the permissions set for users. If I download something with sabnzbd its always locked to root.
Darqfallen
Newbie
Newbie
Posts: 1
Joined: October 9th, 2010, 8:54 pm

Re: chown script

Post by Darqfallen »

I had a similar issue, Sabnzbd is running on another device but ultimatly the files are trasnfered to my freenas box for storage. What you could do is create a scripts directory on your freenas box and have cron run it every 5 minutes.
The script then sets the owner of the download directory for you every 5 mintues.

Something like below

Code: Select all

#!/bin/bash
chmod -R 777 /mnt/*
chown -R newuser:wheel /mnt/*
That makes anyone able to read the files from /mnt on. Change that to suit your needs.

I actually run this script every 5 seconds because I am impatient.
Post Reply