LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-19-2006, 09:03 AM   #1
jagannathan.r
LQ Newbie
 
Registered: Feb 2006
Posts: 5

Rep: Reputation: 0
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
 
Old 12-19-2006, 11:19 AM   #2
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
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.
 
Old 12-19-2006, 12:28 PM   #3
letitgo
Member
 
Registered: Jul 2003
Location: New Orleans
Distribution: Slackware 14.2
Posts: 116
Blog Entries: 1

Rep: Reputation: 16
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...

Last edited by letitgo; 12-19-2006 at 12:30 PM.
 
Old 12-19-2006, 02:09 PM   #4
raskin
Senior Member
 
Registered: Sep 2005
Location: France
Distribution: approximately NixOS (http://nixos.org)
Posts: 1,900

Rep: Reputation: 69
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?
 
Old 12-19-2006, 05:09 PM   #5
letitgo
Member
 
Registered: Jul 2003
Location: New Orleans
Distribution: Slackware 14.2
Posts: 116
Blog Entries: 1

Rep: Reputation: 16
Quote:
Or do you exclude server daemons from users group? It's not obvious for newbie.
a verry good point...no I don't--users was a bad example.
I do use groups "Audio" & "Video" to restrict some programs from everyone.


Quote:
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?
Another good point--but I don't keep a+rwx files in /tmp by
choice, do you? The thread started asking for 777 permissions.

Quote:
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?
Yes--I was unclear--I meant that the script should set the _file_
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?
 
Old 12-19-2006, 05:30 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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.

Last edited by chrism01; 12-19-2006 at 10:58 PM.
 
Old 12-19-2006, 10:12 PM   #7
letitgo
Member
 
Registered: Jul 2003
Location: New Orleans
Distribution: Slackware 14.2
Posts: 116
Blog Entries: 1

Rep: Reputation: 16
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
 
Old 12-20-2006, 09:13 AM   #8
Netizen
Member
 
Registered: Sep 2003
Location: Texas
Distribution: Slackware and Ubuntu
Posts: 355

Rep: Reputation: 30
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.

Last edited by Netizen; 12-21-2006 at 10:32 AM.
 
Old 12-21-2006, 10:14 AM   #9
jagannathan.r
LQ Newbie
 
Registered: Feb 2006
Posts: 5

Original Poster
Rep: Reputation: 0
adding tasks to startup

Quote:
Originally Posted by Netizen
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 go.
Thanks a lot for all your responses . Fixed the issue with the help of you folks.

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
 
  


Reply



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
Auto-Mounting a Windows Share On Starup FlamingBee Linux - Networking 30 07-25-2005 08:38 AM
editing starup programs NNP Linux - General 5 05-15-2005 01:27 PM
linux tasks lennysokol Linux - Software 1 04-28-2005 12:47 AM
slax starup music Maver Linux - Distributions 5 06-26-2004 11:05 AM
something on Linux like Scheduler Tasks on NT ashley75 Linux - General 4 09-26-2003 11:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:34 AM.

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