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 » September 21st, 2010, 12:15 pm

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: 666
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: chown script

Post by rascalli » September 21st, 2010, 2:01 pm

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 » September 24th, 2010, 10:24 am

oops i ment chown

User avatar
rascalli
Moderator
Moderator
Posts: 666
Joined: January 18th, 2008, 12:30 am
Location: Bossche bollen land

Re: chown script

Post by rascalli » September 24th, 2010, 11:07 am

normally chown command is done like this in linux :

chown usernamehere:usernamehere -R $1

User avatar
jcfp
Release Testers
Release Testers
Posts: 892
Joined: February 7th, 2008, 12:45 pm

Re: chown script

Post by jcfp » September 24th, 2010, 11:44 am

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 » September 25th, 2010, 7:39 am

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 » October 9th, 2010, 9:48 pm

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