|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Permission denied problem
I am trying to tidy our server and write cron to keep it tidy.
We took on a third party to do some work last year. They were given their own UID/pwd so that they would have limited access. Part of what they wrote created an archive file at the end of every day. A year on and we don't want to keep all the archives. I am trying to write a line that will delete all files older than 30 days from the folder (that I can insert into our standing monthly cronjob). Find –name “*.html” –mtime +30 –exec rm –f {} \; This command works only when I have gone in under the the old UID. If I try to run it from the standard UID I get 'Permission denied'. So obviously cron won't work for me yet. What should I try next to get around this file permission problem? thx RexJ |
| Sponsored Links | ||
|
|
|
|||
|
There is a standard solution to this: use the "root" user to access every file, regardless of who owns it.
The other possibility would be to put your cron job into the crontab of the UID which owns the files. Every user has a separate crontab, which is a readable ASCII file. The location depends on the UNIX you are using, for instance in IBMs AIX the crontabs are located in "/var/spool/cron/crontabs/<user>" where "<user>" is the user accounts name. Your "find" command seems to be correct save for a missing starting directory: find <some_start_dir> –name “*.html” –mtime +30 –exec rm –f {} \; but keep in mind that a process started from cron does not inherit the environment like a process started from an interactive shell does. if you write "find" instead of "/usr/bin/find" chances are you get a "command not found" error, because the PATH variable, which you have probably set in your login shell is not set for cron jobs. (This is, btw., the absolute number-1-error in this and the Shell-Programming-and-Scripting forum.) I hope this helps. bakunin |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| ssh permission denied | gefa | AIX | 3 | 12-04-2008 10:52 AM |
| Permission Denied | howeezy | UNIX for Dummies Questions & Answers | 0 | 09-14-2005 10:52 AM |
| tar : permission denied | big123456 | UNIX for Advanced & Expert Users | 0 | 09-09-2005 05:32 AM |
| BSD Permission Denied Problem | Phyber | UNIX Desktop for Dummies Questions & Answers | 2 | 03-18-2002 01:24 AM |
| permission denied?? | justchillin | UNIX for Dummies Questions & Answers | 6 | 08-10-2001 04:19 PM |