LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-17-2006, 10:57 PM   #1
ricksoft
LQ Newbie
 
Registered: Feb 2005
Location: Orizaba, Veracruz; México
Distribution: Gentoo Linux
Posts: 3

Rep: Reputation: 0
Unhappy change bzip2 output file permisions


I use cron for make a hourly backup of a postgresql database:

pg_dump -C -d -U user database | bzip2 -tz9 /anydir/backup.sql.bz2

the problem is that the file permisions are rw-r-r, how i can change it to be only rw for owner with that command? Thanks.
 
Old 08-17-2006, 11:13 PM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Will the following do what you want?
Code:
pg_dump -C -d -U user database | bzip2 -tz9 /anydir/backup.sql.bz2 && chmod go-rwx /anydir/backup.sql.bz2
 
Old 08-18-2006, 02:16 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Isn't that the umask setting? As in "umask 077; pg_dump etc; etc"?
 
Old 08-18-2006, 09:38 AM   #4
ricksoft
LQ Newbie
 
Registered: Feb 2005
Location: Orizaba, Veracruz; México
Distribution: Gentoo Linux
Posts: 3

Original Poster
Rep: Reputation: 0
Talking Omfg!!!!!

dam!!! i'm so newbie... I was thinking about change permisions on stdout or something like that but K.I.S.S. always is the answer... thanks guys . By the way... umask does not affect the creation of new files??? sample:

umask 077; touch myfile1;
touch my file2; (my file2 is 077 too, isn't?)
does i have to do: umask077; touch myfile1; umask 022; touch file2 for turn back permissions?, i use the backup line at crontab.


Last edited by ricksoft; 08-18-2006 at 09:45 AM.
 
Old 08-18-2006, 02:35 PM   #5
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
The umask setting will last until your shell exits. If your umask statement is in a script, it will only take effect for the shell that script runs in and does not effect the calling shell. If you type it at a shell prompt, it will last until that shell exits.

You can test this by checking your umask value prior to running the script, running the script (with the umask statement in it) and checking your umask value again after the script. Any files created in the script will have the new umask value, but your umask at the shell prompt at the end is the same as before running the script.

At least, that's what happened in my bash shell just now...
 
Old 08-18-2006, 04:05 PM   #6
ricksoft
LQ Newbie
 
Registered: Feb 2005
Location: Orizaba, Veracruz; México
Distribution: Gentoo Linux
Posts: 3

Original Poster
Rep: Reputation: 0
Talking thank you everyone

thanks guys... be well.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
/etc file permisions pingvina Linux - Software 6 02-27-2006 12:42 PM
howto chowto change file permisions in multiplhange file permisions in multiple dirs? pingvina Linux - Software 3 01-13-2006 03:10 PM
file permisions citrus Linux - Newbie 1 01-04-2006 05:06 AM
file permisions speedemonV12 Linux - Newbie 8 07-19-2005 11:03 AM
looking up file permisions starwind Linux - Newbie 1 10-15-2003 07:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 03:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration