Help - Search - Members - Calendar
Full Version: Chmod A+rw
Linuxhelp > Support > Technical Support
Termina
Sorry, that's supposed to be a lowercase "a" up there.

Been reading around, and I saw this command. Was wondering what the "a" does.

*Is hoping it continously makes sure that the file is rw* Which would be cool. happy.gif
Robert83
Hi,

a means all users

the + means that the new rules are added to the existing rules of the file, so my guess would be

if a file is r and x

and if you do a chmod +w it will be rwx

Sincerely
Robert B

ps.: Termina do you know anything about that grub thing that I posted earlier ? smile.gif
Termina
Hey, sure. smile.gif I'll give it a shot.

Thanks. =/ Do you know any way to have a file retain it's permissions? (so if anything changes it's permissions, it changes back?) Short of a bash script, contiously running chmod a+rw filename, I have no clue. happy.gif
Robert83
Hi,

I think this bash script would do the job :

CODE
# /bin/bash
PATH = /bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin

chmod 755 your_file_name_here


after you save it as , for example guardian
chmod 755 guardian

and use cron to do it every 5 minutes...

like this
touch mycronjob
and put in it the following line 5 * * * * /home/scripts/guardian
crontab mycronjob

and

crontab -l
to see if it's there and shows up as it should

Sincerely
Robert B
Termina
Was hoping for a way without a bash script (I have one, but I had a bad experiance last time when I made a bad one... it kept the chgrp and chmod proccesses alive for some reason, I ended up having several thousand chgrp/chmod's going at once). happy.gif

Fun stuff. ;-_- I almost had 2 months uptime too (bragging rights... ho ho!)
Hemant
QUOTE
# /bin/bash
PATH = /bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin

chmod 755 your_file_name_here


I don't think your bash script will revert the permissions...of a file...rather it will set the permission..to 755 for every file...specified....What say you?????isn't it???
Robert83
Yes, you are right...

What you would need to do is somehow check the file premission with ls -l and put it into a file,
and after that compare it with the original file every 5 minutes, and if its ok , then do nothing, if it has changed , then revert to the original...but I don't know how to do this.

Sincerely
Robert B
hughesjr
we (I smile.gif ) could write a script where you put in the owner, group, file permissions you want and it checks the files (and/or directories) in question and changes the permissions ...

BUT, really, we should instead address what is causing the file permissions to change and try and fix that process so it writes the files the way you want them written in the first place.
jetblackz
The a is redundant since no a means a. You can try

chmod a+x file

or

chmod +x file

Results are the same. In the future, you should do

man chmod

for help pages.
Hemant
Basically permissions of a file doesn't changes on the fly..Usually if a program is using a file it doesn't changes the permissions of a file..But sometimes when you access some users home directory as superuser and copy stuff there....the user can read the file but can't delete it..
Or if you change the permissions of a file manually ..like
CODE
$ chmod 646 file_name


So in my opinion it is very much redundant to have such a script.But anyway how will you know the old permissions of a file..so that you can revert to it..
I don't think there is a easy way..out unless you try to have a script that creates a file and stores permissions of a file whose permissions has been changed..and executed at that particular moment..think about it would be really frustrating...

You have writeen a bash script and now you change the permission of file using
CODE
$ chmod +x file_name
$ ./file_name

but second command will give some error because..you lurking bash script will revert the permissions of that file.
Waste of time isn't it....
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2017 Invision Power Services, Inc.