Can I add tasks to starup in linux
Hi everyone
Everytime I restart the machine there are some files being created in /tmp directory . These files are used by processes used by several people . So when the person logs in after a reboot the files are created with 544 permission under that user alone . SO when processes used by other users try to access this file they are not able to . So what I need is to change the file permission to 777 everytime the system reboots . Is there anyway to add this to startup automatically without depending on any users to actually change the permission . Iam relatively a newbie , so would like to know how to do it in GNU/linux . Thanks |
Save a command that changes permission when run under user's login in a file. Put "#! /bin/bash" in first line, and your command in second. "chmod a+rx" it. Check it works also from root when run with parameter "start" (really don't think about parameters - you should just ignore them for this script). Copy it to /etc/rc.d/init.d . Create links to it with names starting with letter "S" from /etc/rc.d/rc*.d . Should work now.
|
Hi,
Just my $.02 more..Raskin's suggestion should work well, but are you sure you need 777 permissions? It may be a superstition, but files with lesser permissions and group ownership always seem safer to me (perhaps security paranoia) Are you sure that a chown with read and write permissions for the group (say users) won't be enough for the script? I.E., at system startup chown root:users /tmp/filename chmod 760 /tmp/filename Where permissions 760 would be for a file not executable and 770 would be for one that needs to be executable. This retains root ownership and lets members of the group users have rw and in the case of 770 execute privileges. Of course the folks loging on would have to be members of the group "users" and the command can be made more specific by creating a group just for this particular file usage...but I suppose that is paranoid. I'd also note that a slackware specific solution would put the script in etc/rc.d/rc.local to run at system startup since that's where it suggests local scripts should be. From there as Raskin wrote except that the permissions for initd's become 760 or 770... |
Sorry, but "everyone in users but o-rwx" seems to me useless in absolutely most cases - it's still write for all. Or do you exclude server daemons from users group? It's not obvious for newbie. And in tmp it is normal to have a+rw files - if they are security-critical, why are they in tmp in first place, where they can get some strange effects? Also I think that simple script in init.d can be a+rx (and NEVER even g+w, not to mention o+w). What does it change?
|
Quote:
I do use groups "Audio" & "Video" to restrict some programs from everyone. Quote:
choice, do you? The thread started asking for 777 permissions. Quote:
to more restrictive permissions, not that the script itself should be set there. I see no reason not to set the scripts to permissions that jagannathan.r's distro usually sets them to. Thanks for forcing me to think about this...My general rule is to use the least permissions that will get the job done..usually I don't even consider if it's needed or not, I just do it, then loosen things up if needed. Also we're talking System V startup not BSD right? Some distros don't have /etc/rc.d/init.d files (Slackware & derivatives) This is either simpler or out-of-date depending on one's point of view. Umm...jagannathan.r, which distro are you using? |
The general convention is that /tmp is only used for files that are 'temporarily' needed, hence the name.
Some systems even clean it out on reboot. Any files that are 'really' being used should be in a user's dir, with the relevant group perms if they need to be shared. |
jagannathan.r, since you wrote: "I am relatively a newbee..."
I'm sorry if I moved this thread on to permissions and groups that you didn't ask about. But if you are interested in this topic, you may find this link on ownerships and permissions interesting. http://www.linuxforums.org/security/...rmissions.html I did. --Lawrence |
If your distro uses the BSD-Style init, then you can add them to /etc/rc.local. /etc/rc.local is used for local administration, new daemons, and so forth.
|
adding tasks to startup
Quote:
Changed the rc.local file and was able to add therequired tasks to startup . The link provided for the permisiions was very helpful . Regards , Jagan |
All times are GMT -5. The time now is 01:48 AM. |