LinuxQuestions.org
Help answer threads with 0 replies.
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-06-2011, 12:24 AM   #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-06-2011, 12:28 AM   #2
kingbeowulf
Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware64 14.2 Slackware 14.2, Slackware{32,64}-current
Posts: 785
Blog Entries: 3

Rep: Reputation: 275Reputation: 275Reputation: 275
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-06-2011, 12:31 AM   #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-06-2011, 12:58 AM   #4
kingbeowulf
Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware64 14.2 Slackware 14.2, Slackware{32,64}-current
Posts: 785
Blog Entries: 3

Rep: Reputation: 275Reputation: 275Reputation: 275
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, 01: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, 01:07 AM   #6
kingbeowulf
Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware64 14.2 Slackware 14.2, Slackware{32,64}-current
Posts: 785
Blog Entries: 3

Rep: Reputation: 275Reputation: 275Reputation: 275
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, 01: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,226

Rep: Reputation: 402Reputation: 402Reputation: 402Reputation: 402Reputation: 402
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, 01: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, 01: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, 01:13 AM   #10
kingbeowulf
Member
 
Registered: Oct 2003
Location: WA
Distribution: Slackware64 14.2 Slackware 14.2, Slackware{32,64}-current
Posts: 785
Blog Entries: 3

Rep: Reputation: 275Reputation: 275Reputation: 275
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, 01: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, 01:29 AM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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, 01: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, 01:40 AM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,411

Rep: Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397Reputation: 2397
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, 01:42 AM   #15
TheIndependentAquarius
Senior Member
 
Registered: Dec 2008
Posts: 4,680
Blog Entries: 29

Rep: Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917Reputation: 917
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 TheIndependentAquarius; 07-06-2011 at 02:00 AM. Reason: frieza corrected the dumb mistake
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 05:41 PM
CLI copy is greater than GUI copy ?? 0_o killahsmurf Slackware 14 01-04-2006 12:53 PM
boot error after using Copy Commander to copy debian system onto larger new drive Interceptor Linux - Hardware 7 05-04-2003 01:40 PM

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

All times are GMT -5. The time now is 09:51 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration