LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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-22-2009, 04:33 PM   #1
n3mbers
LQ Newbie
 
Registered: Jul 2009
Posts: 10

Rep: Reputation: 0
Is it possibel to halt script running at login to root?


Hi guys just a quick one really, i have written a script and stupuidly put it in my etc/profile.d/ directory, so it runs at login in to root is there any way i can log in to root and not have it execute?
 
Old 07-22-2009, 04:37 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Removing it from /etc/profile.d cannot be a chance?
 
Old 07-22-2009, 04:41 PM   #3
n3mbers
LQ Newbie
 
Registered: Jul 2009
Posts: 10

Original Poster
Rep: Reputation: 0
script halt on root login

No its not possible as it logs off
 
Old 07-22-2009, 05:27 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Do you mean you're not able to login as root (or any other user) that immediately logout? Well... I don't know if booting in single user mode can help, but maybe your best chance is to boot with a live CD (e.g. Knoppix) and manually remove the offending script.
 
Old 07-22-2009, 06:05 PM   #5
n3mbers
LQ Newbie
 
Registered: Jul 2009
Posts: 10

Original Poster
Rep: Reputation: 0
I hope im not being too stupid but at the moment the only account is root as i have not had chance to setup other users, the question is how do i log in as single user?
 
Old 07-22-2009, 06:18 PM   #6
n3mbers
LQ Newbie
 
Registered: Jul 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Ok sorry i have booted in single user but question can i only login as root as if thats the case i still have the same problem, the script shutsdown the machine ie, shutdown - h now, and i need to disable this script, however, its in etc/profile.d which automatically executes
 
Old 07-22-2009, 06:31 PM   #7
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Indeed scripts in /etc/profile.d are usually sourced by /etc/profile, I'm afraid the single user mode does not skip that step, since it requires a login. Can you obtain a LiveCD, instead? I think it is the best solution.
 
Old 07-22-2009, 06:33 PM   #8
n3mbers
LQ Newbie
 
Registered: Jul 2009
Posts: 10

Original Poster
Rep: Reputation: 0
no not at mo looks like i gonna have to do a reinstall, at least i wont do THAT again lol.
 
Old 07-22-2009, 06:51 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
You can often use

linux rescue

at the boot prompt from the install CD/DVD. That doesn't boot off the HDD. You then mount the disk eg sda1 in rw mode & edit the file.
Please add your distro & version to your profile to help us help you.
 
Old 07-22-2009, 08:09 PM   #10
n3mbers
LQ Newbie
 
Registered: Jul 2009
Posts: 10

Original Poster
Rep: Reputation: 0
im running slackware 12, i have tried to run in rescue mode but i get the same effect, it wont let me login without going through root then it shuts down.
 
Old 07-22-2009, 08:19 PM   #11
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,546
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

You can just use your Slackware install cd/dvd to boot the system.
After you get to the login then from the cli (command line);

Code:
~#mkdir /slacktemp                   #temporary mount point
~#mount /dev/your_device /slacktemp  #the device you installed too
~#cd /slacktemp/etc                  #change to directory 
~#vi your_file
You could just mount to '/mnt' then do your edit. You could add to your '/etc/lilo.conf' a stanza to boot to single user mode and then edit as you desire. If you do adapt your '/etc/lilo.conf' then be sure to update by running 'lilo'.
 
Old 07-22-2009, 08:25 PM   #12
n3mbers
LQ Newbie
 
Registered: Jul 2009
Posts: 10

Original Poster
Rep: Reputation: 0
Hi guys thanks for all of your help but i have decided to reinstall its much faster i will be here all nite and day trying to remedy this and its probably faster for me to just reinstall. I have only just installed slackware and its still the fastest option for me, i should have it back up in the morning so its no big deal really i justy wont put any more bash scripts in my /etc/profile.d directory unless i really need to. Thank you fopr all the help anyway. I really appreciate it.
 
  


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
Bash script not running on shell login. uncle-c Linux - Newbie 8 02-21-2009 10:41 AM
Running Script Upon Login edwin11 Linux - Software 7 06-26-2006 05:24 AM
How to run a script as root upon login zugvogel Linux - Newbie 7 09-09-2005 12:10 PM
Running a script at user login? brucebearau Debian 1 01-19-2004 05:28 AM
Running a script as root davee Linux - Newbie 3 02-07-2003 06:27 AM


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