LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can't copy into / (https://www.linuxquestions.org/questions/linux-newbie-8/cant-copy-into-890126/)

IlbiStarz 07-05-2011 11:24 PM

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.

kingbeowulf 07-05-2011 11:28 PM

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.

IlbiStarz 07-05-2011 11:31 PM

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

kingbeowulf 07-05-2011 11:58 PM

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.

IlbiStarz 07-06-2011 12:04 AM

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.

kingbeowulf 07-06-2011 12:07 AM

http://www.debian-administration.org/articles/28

You need to set your script to executable, and then tell your distro to run it.

frieza 07-06-2011 12:07 AM

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.

IlbiStarz 07-06-2011 12:08 AM

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?

IlbiStarz 07-06-2011 12:13 AM

They are set as executable, but it is greyed out saying that I am not root.

kingbeowulf 07-06-2011 12:13 AM

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.

IlbiStarz 07-06-2011 12:17 AM

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?

chrism01 07-06-2011 12:29 AM

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

IlbiStarz 07-06-2011 12:36 AM

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!

chrism01 07-06-2011 12:40 AM

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.

Aquarius_Girl 07-06-2011 12:42 AM

Quote:

Originally Posted by IlbiStarz (Post 4406350)
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.


All times are GMT -5. The time now is 05:58 PM.