Can is set permissions temporarily?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Can is set permissions temporarily?
# 1  
Old 05-16-2008
Can is set permissions temporarily?

I want to do just what the title says. Here's why:

I am adapting a script that backups to a mount. In the script it has a catch where if the drive isn't RW then it unmounts and attempts to remount RW.

# attempt to remount the RW mount point as RW; else abort
$MOUNT -o remount,rw $MOUNT_DEVICE $SNAPSHOT_RW ;
if (( $? )); then
{
$ECHO "snapshot: could not remount $SNAPSHOT_RW readwrite";
exit;
}
fi;


I want to backup to another directory on the same drive, but i want that directories normal everyday permissions to be read only except for when i run the backup script. Is there a way to say "while this script runs apply these permissions to this directory? without simply chmoding at the front and backends of the script?

Suggestions are welcome.

Thanks,
Movomito
# 2  
Old 05-16-2008
Quote:
Originally Posted by Movomito
I want to backup to another directory on the same drive, but i want that directories normal everyday permissions to be read only except for when i run the backup script.
You're a bit hard to understand (among others your use of genitive is improper).

How I understand you:
i) you have a media which is mount ro
ii) you want to backup to it
iii) you therefore want to set only one dir of that drive to be writeable

That is not possible. In order to write to that device you need to mount it rw. Why don't you simply mount it rw?
# 3  
Old 05-16-2008
sorry... perhaps i was unclear.

I want to backup one directory to another on the same drive. I don't want to use mount at all. The script that i am adapting uses mount in the section that i made in blue in the original post. The function of that section was to ensure that the device being used to backup to (in the script that i am adapting from) was mounted Read Write, and then at the end they unmount Read Only. I didn't describe this very well in my previous post.

But i am not trying to backup to an external device. Instead, i am simply backing up to another directory on the same file system (i am aware of the risks involved with this, it is on a Raid array using raid 5). The file system that i am backing up is huge and making it inaccessible to other users while the backup takes place is not really an option. So i would like to temporarily set the permissions to READ WRITE while the backup takes place, but when it is finished leave the backup directory as READ only. If i use chmod on the whole thing it will take forever, or at least that much longer. I would like to avoid having to do this. My hope, and reason for posting, is that there is a way to invoke permissions only during the actual backup process.

I hope this provides a little clarification.

Thanks.
# 4  
Old 05-16-2008
Quite likely you are going to do something that will hurt you in the future.

Maybe it's best not to use that script which does not seem to fit your task. Is it maybe easier to use e.g. rsync? (and that tool can also backup very efficiently over network, if desired. I do use it to (in place, incrementally) backup about 70 GB over a 1 mbit line)
[code]rsync /actual/data /backup/data --chmod=mode[/quote]

However:
That remount rw should not affect your running operations. A remount ro is likely to fail or hurt you - comment it out.

Quote:
The file system that i am backing up is huge and making it inaccessible to other users while the backup takes place is not really an option. So i would like to temporarily set the permissions to READ WRITE while the backup takes place
Which permissions? Those of the actual data!? Aren't they rw already?

Why do you want the backup'd data to be ro? First that's no real security, second it will prevent you from fast recovery in case of data loss.

If your script does not really care about permissions you can try to invoke umask (see man page) with some restrictive mask before running that script.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

Set ACL permissions Solaris

I want to set ACL permissions using this command in solaris 10 , but I get an error message. server# mkdir dir1 server# setfacl -m user:allan:rwx dir1 setacl error: Operation not applicable Any one can help in this matter. Please use CODE tags as required by forum rules! (2 Replies)
Discussion started by: AbuAliiiiiiiiii
2 Replies

2. Shell Programming and Scripting

Fork: Resource temporarily unavailable

Hi friends, Working on a linux X86-64 bit system, I suddenly started getting this error (mentioned in subject) from various scripts. I googled, found that there are couple of reason which causes this issue. - less memory I am pretty sure, memory seems to be stable on my system and at the... (15 Replies)
Discussion started by: clx
15 Replies

3. Red Hat

Set permissions for new files created by application

Hello All, I have an application that creates the log files and they created with 600 permissions instead of 644(default). How can I set the permissions so that files can be created with 644. I looked into the /etc/profile for the umask settings and it is set 002(if UID>199). And when I type... (5 Replies)
Discussion started by: s_linux
5 Replies

4. UNIX for Dummies Questions & Answers

To set different file permissions for different users of same group

Hi, If User1, User2 and User3 are in the same group. User1 should not be able to view the files of User2 and User3. But User2 and User3 should be able to view all files. How to set permission for this. Please help. Thanks, Priya. (1 Reply)
Discussion started by: banupriyat
1 Replies

5. SuSE

How to set permissions for files which get rolled over?

Hi, One application that I have generates log files into a specific folder in SUSE. When the size of the log file reaches 50 MB, it gets rolled over and it is stored as testlog_1.log and the new events are logged in testlog.log When I set a chmod -R 744 on the directory of these logs, it... (4 Replies)
Discussion started by: graosn
4 Replies

6. Red Hat

cannot set user id: Resource temporarily unavailable (not open file/open process related)

First post, sorry to be a bother but this one has been dogging me. I have a process user (java application server) that trips a resource limit every couple weeks and need help finding what limit we're hitting. First, this is what's running: This is the error when jobs are run or the... (0 Replies)
Discussion started by: Katahdin
0 Replies

7. Shell Programming and Scripting

temporarily suspend crontab

Issues: Cron jobs are running everyday at 8PM to hot backup database, archivelog, and some other files. Sometimes crontab scheduled backups need to be suspended for some other tasks randomly but doesn't happen all the time. Objective: I need to create simple script or command ( example :... (7 Replies)
Discussion started by: Paul.S
7 Replies

8. Post Here to Contact Site Administrators and Moderators

RSS Diabled Temporarily - Please Discuss Here.

We have disabled RSS temporarily and apologize for any problems this may cause anyone. If you want to discuss this, please post here. (0 Replies)
Discussion started by: Neo
0 Replies

9. AIX

how to block a user temporarily?

hi to all i'm a newbie on aix. how would i block temporarily a few users in accessing our aix server so that other users may not be affected by th cpu usage...because if all of them accessing our server the CPU utilization goes high... thanks winky (3 Replies)
Discussion started by: winky
3 Replies
Login or Register to Ask a Question