LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-05-2011, 11:24 PM   #1
IlbiStarz
LQ Newbie
 
Registered: Jul 2011
Posts: 18

Rep: Reputation: Disabled
Can't copy into /


Hi everyone,

I'm trying to run a script upon startup. I've read that I should put the file into /etc/init.d. However, I cannot work in it. I can't make or paste files into that directory. Any help on how to move the file?

Thanks.
 
Old 07-05-2011, 11:28 PM   #2
kingbeowulf
Senior Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware
Posts: 1,266
Blog Entries: 11

Rep: Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744
you need to be "root". In general it is a BAD idea to allow regular users access to the system areas. Use the commands "su" or "sudo" depending on how your distro is set up.
 
Old 07-05-2011, 11:31 PM   #3
IlbiStarz
LQ Newbie
 
Registered: Jul 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
How do you be root exactly? I've used sudo -i and sudo bash. Do I have to use terminal to copy them? I don't see how being root in terminal helps me physically copy the files into /etc
 
Old 07-05-2011, 11:58 PM   #4
kingbeowulf
Senior Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware
Posts: 1,266
Blog Entries: 11

Rep: Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744
If you don't know how to log on as "root" or to run the filemanager or editor as root, then you have absolutely no business putting a script into init.d at all. You need to learn your distro.

http://tldp.org/LDP/gs/node1.html
http://linuxcommand.org/

Once you are root in a terminal, you can do ANYTHING. You can even run your desktop GUI apps as root. Look up the 'cp' command. See the links above.
 
0 members found this post helpful.
Old 07-06-2011, 12:04 AM   #5
IlbiStarz
LQ Newbie
 
Registered: Jul 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
Yeah I figured it out. I used the cp command to copy the file into /etc/init.d

I rebooted, but it still doesn't work. Nothing runs when I login.
 
Old 07-06-2011, 12:07 AM   #6
kingbeowulf
Senior Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware
Posts: 1,266
Blog Entries: 11

Rep: Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744
http://www.debian-administration.org/articles/28

You need to set your script to executable, and then tell your distro to run it.
 
Old 07-06-2011, 12:07 AM   #7
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
i would agree with beoowulf999, if you don't even know HOW to log into your system as root, or temporarily become root, then it would be dangerous for you to be messing around with init scripts, as root you can torch your system and nothing will stop you. trust me i've done it.. when i was learning how to use Linux i lost count of how many times i hosed my system to the point of having to reformat it.
That being said, you should simply have to put a line to invoke your script in /etc/rc.local, but you'll have to use root powers to edit the file.
 
Old 07-06-2011, 12:08 AM   #8
IlbiStarz
LQ Newbie
 
Registered: Jul 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
Okay before I couldn't open anything in /etc but now I can. I double click my script BUT it closes before it actually starts. (I have a sleep 10 in the beginning)

Usually, I would open the script using ./script1 in terminal. Am I supposed to change the type of way it opens up or something to make it work upon startup?
 
Old 07-06-2011, 12:13 AM   #9
IlbiStarz
LQ Newbie
 
Registered: Jul 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
They are set as executable, but it is greyed out saying that I am not root.
 
Old 07-06-2011, 12:13 AM   #10
kingbeowulf
Senior Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware
Posts: 1,266
Blog Entries: 11

Rep: Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744Reputation: 744
frieza, do Debian style distros have a rc.local? I don't have any running anymore so can't check. I'm more familiar with the BSD style in Slackware.
 
Old 07-06-2011, 12:17 AM   #11
IlbiStarz
LQ Newbie
 
Registered: Jul 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
You guys are confusing me with your super smartie talk XD

Can someone just walk me through step by step on how to do this...using English?
 
Old 07-06-2011, 12:29 AM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
1. tell us what distribution of Linux you have and what version. Try these cmds at the cmd line to find out
Code:
cat /etc/*release*

uname -a

2. post your script so we can see what it does

3. do you want this script to run when the system boots OR when you login? The two are completely separate issues.

4. do you want it to run once only or continuously

5. Useful links
http://linux.oneandoneis2.org/LNW.htm - MS v Linux differences
http://rute.2038bug.com/index.html.gz - a great tutorial
 
Old 07-06-2011, 12:36 AM   #13
IlbiStarz
LQ Newbie
 
Registered: Jul 2011
Posts: 18

Original Poster
Rep: Reputation: Disabled
1. Ubuntu 11.04 64bit

2. DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=11.04
DISTRIB_CODENAME=natty
DISTRIB_DESCRIPTION="Ubuntu 11.04"

Linux 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:24 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

3. Don't I have to login for it to run? See I know nothing about Linux
Uhh I am going to be disabling login, so I'm guessing when it boots?

4. Run once every time I boot (or is it login :/ )

5. I don't have time to read right now sorry, I need to get this working in 2 days!
 
Old 07-06-2011, 12:40 AM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
1. you need to answer my qn 2
2. if you don't know the answer to 3 & 4 its going to be impossible to help you.
Note that the answer to 2 will help, but you must ALSO tell us what the script is supposed(!) to do and we can make a guess based on that.
 
Old 07-06-2011, 12:42 AM   #15
Aquarius_Girl
Senior Member
 
Registered: Dec 2008
Posts: 4,731
Blog Entries: 29

Rep: Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940Reputation: 940
Quote:
Originally Posted by IlbiStarz View Post
I don't see how being root in terminal helps me physically copy the files into /etc
'/' depicts the Root account directory. Root means that, that particular account directory has got some special set of permissions and to access and modify the files of that account directory you need to have those special permissions (which you can get by specifying that directory's password).

'/etc' means that 'etc' directory is in '/'.

and secondly, you can log in, in the root account directory through GUI too, logging in through terminal is not compulsory.

Last edited by Aquarius_Girl; 07-06-2011 at 01:00 AM. Reason: frieza corrected the dumb mistake
 
  


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
dow copy copy-protected cds with dd commant gh_D_ir Linux - Software 4 04-01-2011 04:41 PM
CLI copy is greater than GUI copy ?? 0_o killahsmurf Slackware 14 01-04-2006 11:53 AM
boot error after using Copy Commander to copy debian system onto larger new drive Interceptor Linux - Hardware 7 05-04-2003 12:40 PM

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

All times are GMT -5. The time now is 08:06 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