Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have remote location Linux running (CentOS 6.0). It has dynamic ip address so i installed noip2 service and copied the file cp /etc/profile.d/

Here you can see the script running now for ever on reboot (see).

After that when the system restarted once, it never have the correct shell. As a result remotely when i try to ssh the server i cant login and i cant do anything. Can anyone solve this? Here is the details i tried: When i debug the ssh i see that debug1: Authentication succeeded (password). and command is also sent but nothing just happen. I simply cant fix it yet.

All failed:

ssh root@host 'rm -fr /etc/profile.d/'
scp root@host:/etc/profile.d/
ssh root@host /bin/sh
ssh root@host /bin/bash
ssh root@host --norc -i
ssh root@host -- --norc -i
ssh root@host bash --norc -i 
ssh root@host /bin/bash -i './etc/profile.d/noip2 stop'
ssh root@host /bin/bash -i './etc/profile.d/noip stop'
ssh root@host /bin/bash -l './etc/profile.d/noip stop'

many more... combination i tried all failed. Is there any single option that i can try?

share|improve this question
What happens when you tried these exactly? Did you get an error message? If so, what error? – David Schwartz Aug 29 '11 at 15:56
For future reference: calling noip services from /etc/profile.d is a bad idea. (Situation: server reboots, obtains a different address, but DNS is not updated since profile.d is launched at login time, and you cannot login without updating DNS first...) Use /etc/rc.local or similar instead. – grawity Aug 29 '11 at 16:16
What happens when you try pressing Ctrl-C after the "sent command" message is displayed? In most shells, profile files can be interrupted that way. Ctrl-Z and Ctrl-\ may work too. – grawity Aug 29 '11 at 16:17
I tried to put on-site someone to physically remove the /etc/profile.d/ and apply init 6. But on-site with keyboard they cant login either using username root and password. Always they get login prompt now. Ctrl-c i cant apply its very small duration we have in that period. – YumYumYum Aug 29 '11 at 16:21
Can i send remotely ssh root@host 'ctrl-c or ctrl-z' ? – YumYumYum Aug 29 '11 at 16:22

Two possible solutions:

  • login as another user and then use sudo or su to remove
  • use sftp to remove

As a side note, for the dynamic ip problem ddclient is a more robust solution, it support many services, ifup/down hooks and also a daemon mode.

share|improve this answer
I can not login physically either. It prompts login and again prompt login and again prompt login even providing valid password. – YumYumYum Aug 29 '11 at 19:30
I cant even su - it always run the I was testing in a VirtualBox by putting the in /etc/profile.d/ – YumYumYum Aug 29 '11 at 19:30
Tried with Sftp, connection is auto closed always. – YumYumYum Aug 29 '11 at 19:32
su - is the same as running the root account shell, try with su -s /bin/dash (or another shell listed in /etc/shells, csh family of shells are good candidates, they use different configuration files) – Pablo Castellazzi Aug 30 '11 at 3:49
Thanks it was solved finally, i placed the correct steps for future reference. – YumYumYum Sep 3 '11 at 22:19
up vote 0 down vote accepted



  • i was physically into the server
  • then i still cant login it always ask login prompt even physically trying to login
  • So i went to grub menu by pressing shift key and still the same, it always ask login prompt (do not allow me to change even run level)


  1. While booting press shift key
  2. Grub menu press a
  3. add this "init=/bin/sh"
  4. shell appear, then apply rm -fr /etc/profile.d/ (failed because read only)

  5. mount, unmount /

  6. rm -fr /etc/profile.d/ worked

  7. init 6 (failed)

  8. turn the power-off and turn it on (solved the whole crap)

Still now no more issue on this, so its solved, have no problem now. Hope it helps others in future. (do not ever put something in /etc/profile.d/...)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .