Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to restart openssh-server in Ubuntu 10.10 by typing:

sudo /etc/init.d/ssh restart

and I'm getting this error:

sudo: unable to execute /etc/init.d/ssh: Text file busy
share|improve this question
    
What does ls -l /etc/init.d/ssh say? Also, is it sudo itself that's having the problem? Try running some other command with sudo and see if you get the same error message –  DerfK Oct 23 '10 at 14:18

4 Answers 4

up vote 0 down vote accepted

I don't know if it'll make any difference, but Ubuntu's had start and stop service control for a while. E.g:

start ssh
stop ssh

start <service-name-here>
share|improve this answer
    
that seems to do the trick! Thanks! –  binaryorganic Oct 23 '10 at 15:40

It sounds like you might have the file /etc/init.d/ssh open for writing somewhere, and therefore can't execute it. See this answer.

What does

ps -f -p $(pgrep -f -d, '/etc/init.d/ssh')

get you?

share|improve this answer
    
ERROR: List of process IDs must follow -p. –  binaryorganic Oct 23 '10 at 15:39

You can do a

sudo killall sshd

then restart it with

sudo service sshd start
share|improve this answer
    
hmmm... the killall seemed to work, but the start command says "unrecognized service" –  binaryorganic Oct 23 '10 at 12:22
    
oh, and even after killall I can still ssh in. I'm terribly confused. –  binaryorganic Oct 23 '10 at 12:24
    
When you do a ps -ef|grep ssh what do you see? –  hfranco Nov 23 '10 at 17:33

I'm not sure it's also true on Ubuntu but on Debian, you can properly restart your openssh server without using init.d file with:

# start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.